[BUG] awsCredentialExport called even without CLAUDE_CODE_USE_BEDROCK

Status Fixed / completed
Maintainer reply ✓ Yes — ant-kurt
Activity 5 comments · opened Sep 23, 2025 · closed Sep 26, 2025
💡 Likely answer: A maintainer (ant-kurt, collaborator) responded on this thread — see the highlighted reply below.

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

From my local usage, it seems like awsCredentialExport is being exercised even when CLAUDE_CODE_USE_BEDROCK is not set or set, which is surprising for several reasons:

  • I would not expect it to be called if Claude Code is not configured to use Bedrock
  • unless there's a use case of which I'm not aware, it seems unnecessary and therefore doing "wasted" work

What Should Happen?

Any setting or script involved in Bedrock auth (awsCredentialExport, awsAuthRefresh, etc.) should not be exercised if Bedrock is not enabled.

Error Messages/Logs

See "Steps to Reproduce"

Steps to Reproduce

  1. When not using Bedrock and awsCredentialExport returns an invalid structure.

/project-root/.claude/settings.json

{
  "awsCredentialExport": "echo 'should not be called'", 
  "env": {
    "CLAUDE_CODE_USE_BEDROCK": "0"
  }
}

Then Claude returns the following error on startup and on every eval:

Error getting AWS credentials from awsCredentialExport (in settings or ~/.claude.json): awsCredentialExport did not return a valid value
  1. When not using Bedrock and awsCredentialExport returns a valid structure with invalid credentials (which I tried just to get past the first error).

/project-root/.claude/settings.json

{
  "awsCredentialExport": "echo '{\"Credentials\": {\"AccessKeyId\": \"value\", \"SecretAccessKey\": \"value\", \"SessionToken\": \"value\"}}'",
  "env": {
    "CLAUDE_CODE_USE_BEDROCK": "0"
  }
}

Then Claude returns the following error on eval:

API Error (403 The security token included in the request is invalid.) · Retrying in 8 seconds… (attempt X/10)

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

1.0.120 (Claude Code)

Platform

AWS Bedrock

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

In our org, we would like to default users to a Bedrock configuration, and have that committed in /project-root/.claude/settings.json, but since we allow multiple ways of connecting, we'd like the ability to toggle that with by changing only CLAUDE_CODE_USE_BEDROCK. However, because of how the AWS settings are exercised (and the fact that not all of our users have AWS access, or that it requires some setup), the current behavior is both unexpected and prevents non-Bedrock sessions from working like they should.

View original on GitHub ↗

5 Comments

ant-kurt collaborator · 1 year ago

There's an issue where "CLAUDE_CODE_USE_BEDROCK": "0" is evaluated as truthy. You can mitigate this by not setting the value at all. We'll get this fixed!

oehlschl · 1 year ago
There's an issue where "CLAUDE_CODE_USE_BEDROCK": "0" is evaluated as truthy.

Thanks @ant-kurt ! I can confirm that by setting "CLAUDE_CODE_USE_BEDROCK": "" in .claude/settings.local.json, it both overrides "CLAUDE_CODE_USE_BEDROCK": "1"in .claude/settings.json and does not trigger awsCredentialExport.

So, that's a good workaround for now. Appreciate it!

oehlschl · 1 year ago

It looks like this may have been fixed by https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md#10124

Fix Bedrock and Vertex environment variables evaluating all strings as truthy
ant-kurt collaborator · 1 year ago

Fixed in 1.0.124

github-actions[bot] · 1 year ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.