[BUG] Bedrock env vars ignored in home directory
Environment
- Platform (select one):
- [ ] Anthropic API
- [x] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other:
- Claude CLI version:
- Operating System:
- Terminal:
Bug Description
When running claude in the home directory with the ANTHROPIC_* and CLAUDE_CODE_USE_BEDROCK variables set, it seems like Bedrock is still used for queries, but it is no longer respecting the ANTHROPIC_MODEL parameters:
╭───────────────────────────────────────────────────╮
│ ✻ Welcome to Claude Code! │
│ │
│ /help for help, /status for your current setup │
│ │
│ cwd: /Users/callsopp │
╰───────────────────────────────────────────────────╯
> Hello
⎿ API Error: 403 {"Message":"User: xxx/callsopp is not authorized
to perform: bedrock:InvokeModel on resource:
arn:xxx:inference-profile/us.anthropic.claude-3-7-sonnet-20250219-v1:0 because no session
policy allows the bedrock:InvokeModel action"}
That inference profile is the default Bedrock inference profile, which my AWS permissions do not have access to. My ANTHROPIC_MODEL is set to the proper inference profile, but it isn't being used. This only seems to happen when my cwd is my home directory (which isn't advised but some teammates have reasons for doing this, such as on VMs).
Steps to Reproduce
- Set Bedrock env vars
- Try to run a query
- Observe the wrong
ANTHROPIC_MODELis used (should be possible to repro by setting a fakeANTHROPIC_MODELand then still seeing the default profile used)
Expected Behavior
The ANTHROPIC_MODEL should be used
Actual Behavior
The default Bedrock model/inference profile is used
Additional Context
FYI, I'm no longer suffering this problem in 1.0.11. Something between 0.2.125 and now fixed it for me.
- The latest version does indeed fix the home directory issue
- But, the latest version also seems to regress showing the
ANTHROPIC_MODEL(which, in our case, is a non-default inference profile) in theOVERRIDESsection in the intro (which is/was very helpful to debug broken setups). If I do/model, it looks like it is still set / everything works, but the lack of the output in the intro isn't great
- But, the latest version also seems to regress showing the
ANTHROPIC_MODELin theOVERRIDESsection in the intro
I can second this.
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.