[BUG] AWS_PROFILE in settings.json not working
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?
When I set the environment variable AWS_PROFILE in the global settings, it is not used. If I set it directly in my system (with export ) it works.
What Should Happen?
I should be able to use authentication with custom profile and set it in the claude code settings, in order to not interfere with aws commands outside of Claude Code.
Error Messages/Logs
When using the settings file to set the variable, the debug file contains the following :
[ERROR] Error streaming, falling back to non-streaming mode: Could not load credentials from any providers
[ERROR] Error streaming, falling back to non-streaming mode: Could not load credentials from any providers
Steps to Reproduce
- In
.aws/configadd a custom profile for auth, that calls a script
[profile custom-auth]
credential_process = /home/mickael/.claude/scripts/aws_creds.sh
- Confirm it is working :
aws sts get-caller-identity --profile custom-auth - Add
AWS_PROFILEto.claude/settings.json
{
"env": {
"CLAUDE_CODE_USE_BEDROCK": "1",
"DISABLE_PROMPT_CACHING": "1",
"AWS_PROFILE": "custom-auth"
},
"model": "eu.anthropic.claude-3-7-sonnet-20250219-v1:0"
}
- Running
claude --debugand then promptingtestjust hangs, and the debug log shows the errors above - Exit, manually set the environment variable :
export AWS_PROFILE=custom-auth - Running
claudeand promptingtestnow works and gets a response
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
No response
Claude Code Version
2.0.22
Platform
AWS Bedrock
Operating System
Ubuntu/Debian Linux
Terminal/Shell
WSL (Windows Subsystem for Linux)
Additional Information
- I feel like this is somehow related to #5418.
- I also tried with
CLAUDE_CODE_AWS_PROFILEas I was not sure which it is supposed to be. - This probably worked before as it was mentioned in #148 in this comment https://github.com/anthropics/claude-code/issues/148#issuecomment-2852648857 but I never tried it before
Found 3 possible duplicate issues:
- https://github.com/anthropics/claude-code/issues/7660
- https://github.com/anthropics/claude-code/issues/8500
- https://github.com/anthropics/claude-code/issues/5418
This issue will be automatically closed as a duplicate in 3 days.
- If your issue is a duplicate, please close it and 👍 the existing issue instead
- To prevent auto-closure, add a comment or 👎 this comment
🤖 Generated with Claude Code
- Not a duplicate of 7660 because it happens with Node 24 and Node 20
- Not a duplicate of 8500 because it is not the same use case
- Not a duplicate of 5418 but as I originally said it is possibly related. Your checks specifically mention to open an issue for a single bug report
we have a similar issue, with 2.0.31, we're yet to understand why it happens
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.