[BUG] Claude Code no longer respecting ANTHROPIC_MODEL variables
Resolved 💬 17 comments Opened May 21, 2025 by clayallsopp Closed Jun 4, 2025
💡 Likely answer: A maintainer (ant-kurt, collaborator)
responded on this thread — see the highlighted reply below.
Environment
- Platform (select one):
- [ ] Anthropic API
- [x] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other: <!-- specify -->
- Claude CLI version: <!-- output of
claude --version--> - Operating System: <!-- e.g. macOS 14.3, Windows 11, Ubuntu 22.04 -->
- Terminal: <!-- e.g. iTerm2, Terminal App -->
Bug Description
- In the past 24-48 hours, we've seen many engineers run into this issue upon starting Claude Code and entering a prompt:
API Error: 403 {"Message":"User: xxx is not authorized to perform: bedrock:InvokeModel on resource:
arn:aws:bedrock:us-east-1:xxx:inference-profile/us.anthropic.claude-3-7-sonnet-20250219-v1:0 because no session policy allows the bedrock:InvokeModel action"}
This is the _default_ Bedrock inference profile/model ID.
In our setup, we only allow per-user access to their own profiles/model IDs, which we configure via the combination of ANTHROPIC_MODEL, ANTHROPIC_SMALL_FAST_MODEL, and CLAUDE_CODE_USE_BEDROCK environment variables.
But, at the top of Claude Code, it still seems to show the environment variable _correctly_:
╭───────────────────────────────────────────────────╮
│ ✻ Welcome to Claude Code research preview! │
│ │
│ /help for help, /status for your current setup │
│ │
│ cwd: /Users/callsopp/xxx │
│ │
│ ─────────────────────────────────────────────── │
│ │
│ Overrides (via env): │
│ │
│ • Model: arn:aws:bedrock:us-east-1:xxx │
│ :application-inference-profile%xxx │
╰───────────────────────────────────────────────────╯
So I think a recent release has regressed respecting these environment variables at some level of abstraction.
Steps to Reproduce
- <!-- First step -->
- <!-- Second step -->
- <!-- And so on... -->
Expected Behavior
<!-- What you expected to happen -->
Actual Behavior
<!-- What actually happened -->
Additional Context
<!-- Add any other context about the problem here, such as screenshots, logs, etc. -->
17 Comments
This seems to be specifically an issue with
0.2.125- downgrading to0.2.124resolves it@clayallsopp in your ANTHROPIC_MODEL env var, can you replace the escaped slash (
%2F) with a slash (/)? There were some recent changes to how Claude Code expects ARNs.@ant-kurt This sadly did not work for me, downgrading does resolve the issue
I found I suffered this problem only when running
claudefrom the home (~) folder. Running it from another folder works fine.@clayallsopp would you mind providing some more information about the environment to aid in debugging this? Thanks!
~do not resolve this?It also breaks my working setup.
In my case the enterprise layer over bedrock does not have endpoints enabled for listing profiles
@ant-kurt
Having a configuration may help everyone.
Struggling to get repro on this one - @szihs @alatom10 can you share some of the information listed above ^^, as well as confirm this is working in v0.2.124, broken in v0.2.125 through v1.0.1?
This may be used in some flows to confirm model access, but likely isn't the issue.
The intention is that the
ANTHROPIC_MODELandANTHROPIC_SMALL_FAST_MODELflag allow passing model name or ARN - but looks like that's not working quite right for some cases.@ant-kurt
claudein the home directory different/not respecting the environment variables? I can confirm that at least themodel:info is missing in the output when running in the home directory, and then running any prompt gives an unhelpful AWS error (so it seems to be trying to use Bedrock, but then not using the specified models)It was a setup issue at my end. Did clean installation and it works again
I have tried all afternoon trying to make Claude Code work with Bedrock, I cannot get it to work. Below are the configs that I have tried that do not work, with error
Claude Code version: 1.0.3
application-inference-profile with /
Error:
API Error (arn:aws:bedrock:eu-west-1:<redacted>:application-inference-profile/6z8a19dq488l): 400 The provided model identifier is invalid.application-inference-profile with %2F
Error:
API Error: 400 The provided ARN is invalid for the service regionDefault system inference provfile with /
Error:
API Error (arn:aws:bedrock:eu-west-1:<redacted>:inference-profile/eu.anthropic.claude-3-7-sonnet-20250219-v1:0): 400 The provided model identifier is invalid.Direct Inference profile id
Error:
API Error (eu.anthropic.claude-3-7-sonnet-20250219-v1:0): 400 The provided model identifier is invalid.Damn, this finally worked
The key was defining
AWS_REGIONand notAWS_DEFAULT_REGION---
Edit:
To remove the overrides warning from
Welcome to Claude Code!@Moulick we've added support for
AWS_DEFAULT_REGIONas a fallback - sorry for the confusion here@clayallsopp are you still running into your original issue?
@ant-kurt the original issue is fixed (I suspect it was the ARN escaping issue), but the home directory issue remains - do you want me to open a separate issue about that?
Would be great to add this to the documentation!
Update: also missing here https://docs.anthropic.com/en/docs/claude-code/settings#environment-variables
@clayallsopp feel free to open a new issue with the home directory problem - this is a known issue on our side and it would be helpful to gauge how many folks are running into it (we do generally discourage running
claudefrom the home dir, as the UI warning indicates).We added
AWS_REGIONto the first documentation link, and have a further rework upcoming that should clarify this.@ant-kurt opened https://github.com/anthropics/claude-code/issues/1576 to track that
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.