Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

`agentcore dev` container fails with LoginTokenLoadError when using `aws login` credentials

オープン 初心者向け
#2,606 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
80/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
aws, docker, typescript

調査の方向性

ContainerDevRunner.run() から始めてください。ここで CLI が、コンテナに転送される環境変数に AWS_CONFIG_FILE と AWS_SHARED_CREDENTIALS_FILE を設定しています。コンテナの環境変数が一箇所で組み立てられているかどうか、そして転送されるこれらの変数をすでに検証しているテストがあるかどうかを確認してください。コンテナが /aws-config/login/cache を指す AWS_LOGIN_CACHE_DIRECTORY を受け取り、その値をテストがカバーしていれば完了です。

索引モデルが issue の本文から書いたものです。

説明

bug
Description

When running a Container-build agent with agentcore dev using aws login credentials (IAM Identity Center login_session), the agent fails with LoginTokenLoadError on every invocation — even immediately after a successful aws login.

The CLI mounts ~/.aws into the container at /aws-config and sets AWS_CONFIG_FILE=/aws-config/config, but does not set AWS_LOGIN_CACHE_DIRECTORY. The botocore login credential provider ignores AWS_CONFIG_FILE and resolves the token cache path independently via ~/.aws/login/cache, which expands to /home/bedrock_agentcore/.aws/login/cache inside the container — a path that does not exist.

Steps to Reproduce
  1. Authenticate with aws login
  2. Run agentcore dev for a Container-build agent
  3. Invoke the agent
Expected Behavior

The agent resolves AWS credentials successfully using the token cached by aws login, matching the behavior seen in CodeZip-build agents.

Actual Behavior

The agent fails immediately with:

botocore.exceptions.LoginTokenLoadError: Error loading login session token:
Unable to load a existing login session for session
arn:aws:iam::<account>:user/<user>.
Please reauthenticate with 'aws login'.

This happens even when the token is freshly issued and not expired.

CLI Version

1.0.0-rc.5

Operating System

macOS

Additional Context

Root cause: In ContainerDevRunner.run(), the CLI sets:

forwardedEnv.AWS_CONFIG_FILE = "/aws-config/config"
forwardedEnv.AWS_SHARED_CREDENTIALS_FILE = "/aws-config/credentials"

But AWS_LOGIN_CACHE_DIRECTORY is not forwarded. Botocore resolves the login token cache in botocore/utils.py::get_login_token_cache_directory():

def get_login_token_cache_directory():
    if 'AWS_LOGIN_CACHE_DIRECTORY' in os.environ:
        return os.path.expanduser(os.environ['AWS_LOGIN_CACHE_DIRECTORY'])
    else:
        return os.path.expanduser(os.path.join('~', '.aws', 'login', 'cache'))

AWS_CONFIG_FILE has no effect on this path. The token cache is present at /aws-config/login/cache inside the container but the provider looks for it at ~/.aws/login/cache (/home/bedrock_agentcore/.aws/login/cache), which doesn't exist.

Fix: Add one line alongside the existing forwarded env vars:

forwardedEnv.AWS_LOGIN_CACHE_DIRECTORY = "/aws-config/login/cache"

Workaround (entrypoint script):

if [ -n "$AWS_CONFIG_FILE" ]; then
    export AWS_LOGIN_CACHE_DIRECTORY="$(dirname "$AWS_CONFIG_FILE")/login/cache"
fi
主要言語
TypeScript
スター
304
フォーク
105
平均マージ
16時間 14分
マージ済み PR(30日)
186

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

aws/agentcore-cli のほかの issue

aws/agentcore-cli の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。