Skip to content

Infinite installation loop of @aws-sdk/credential-providers on startup when AWS_BEARER_TOKEN_BEDROCK is set #6765

Closed

Description

@ykswang

Description

OpenCode hangs on startup when the AWS_BEARER_TOKEN_BEDROCK environment variable is set. It triggers a re-installation of @aws-sdk/credential-providers on every single launch, even if the package is already successfully installed.
This becomes a blocking issue if the connection to the npm registry is slow or unstable (e.g., when using a custom registry mirror like npmmirror), causing the CLI to hang indefinitely during the network request.

Verification:
I confirmed that manually modifying ~/.cache/opencode/package.json by changing the version of @aws-sdk/credential-providers from the specific version number (e.g., "3.962.0") to "latest" makes the issue disappear immediately.

Root Cause Analysis:
I investigated the source code and identified the issue in packages/opencode/src/bun/index.ts.

  1. src/provider/provider.ts calls BunProc.install("@aws-sdk/credential-providers") without a version, defaulting to "latest".
  2. BunProc.install compares the installed version in package.json (e.g., "3.962.0") against the requested version ("latest").
  3. Since "3.962.0" !== "latest", it forces a bun add command every time, triggering unnecessary network requests.

Plugins

Default

OpenCode version

1.0.220

Steps to reproduce

  1. Export AWS_BEARER_TOKEN_BEDROCK=test_token in your shell.
  2. Run opencode.
  3. The CLI hangs during initialization.
  4. Running opencode --print-logs shows it is stuck at: INFO service=bun ... installing package using Bun's default registry resolution pkg=@aws-sdk/credential-providers version=latest

Screenshot and/or share link

No response

Operating System

macOS

Terminal

iTerm2

Activity

  1. added
    perfIndicates a performance issue or need for optimization
    on Jan 3, 2026
  2. github-actions commented on Jan 3, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if your specific case differs from those issues.

  3. chindris-mihai-alexandru commented on Jan 27, 2026

    @chindris-mihai-alexandru

    I experienced the same BunInstallFailedError with @aws-sdk/credential-providers on OpenCode v1.1.36 running on macOS.

    Environment: AWS environment variables set (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION)

    Workaround that worked:

    cd ~/.config/opencode
    rm bun.lock
    npm install @aws-sdk/credential-providers

    After this, OpenCode starts normally without the installation loop. Can confirm the npm workaround is effective for this version.

  4. github-actions commented on Mar 30, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingperfIndicates a performance issue or need for optimization

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions