[BUG] Claude Code changes model identifier mid-conversation on AWS Bedrock (eu to us region)
Status Closed — not planned
Maintainer reply None cached
Activity 13 comments · opened Aug 4, 2025 · closed Jan 7, 2026
Environment
- Platform (select one):
- [ ] Anthropic API
- [x] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other: LiteLLM
- Claude CLI version: 1.0.67 (Claude Code)
- Operating System: macOS 15.6
- Terminal: Terminal / oh-my-zsh
Bug Description
I have a very odd bug where Claude Code switches the model used in a long conversation. I am using the eu sonnet model via Bedrock, proxied through a LiteLLM proxy. (Computer => LiteLLM => Bedrock)
The model used is eu.anthropic.claude-sonnet-4-20250514-v1:0
After conversing with the model for a while, suddenly this message appears:
⎿ API Error (500 {"error":{"message":"{\"message\":\"The provided model identifier is invalid.\"}. Received Model Group=us.anthropic.claude-sonnet-4-20250514-v1:0\nAvailable Model Group Fallbacks=None\nError doing the fallback: list index out of range","type":"None","param":"None","code":"500"}}) · Retrying in 1 seconds… (attempt 1/10)
Note the model identifier us.anthropic.claude-sonnet-4-20250514 with the us prefix, not eu. We can see from LiteLLM logs that the wrong model identifier is in fact being sent from Claude Code.
Closing CC and then using --resume allows the conversation to continue for a short while before the issue reappears.
Steps to Reproduce
- Run Claude Code with:
AWS_REGION=eu-west-1 AWS_DEFAULT_REGION=eu-west-1 ANTHROPIC_MODEL=eu.anthropic.claude-sonnet-4-20250514-v1:0 ANTHROPIC_AUTH_TOKEN=REDACTED ANTHROPIC_BEDROCK_BASE_URL=https://litellm.REDACTED/bedrock CLAUDE_CODE_SKIP_BEDROCK_AUTH=1 CLAUDE_CODE_USE_BEDROCK=1 claude - Ask CC to do something that requires a couple of minutes of agentic work
- The issue appears.
Expected Behavior
Always use the configured model from ANTHROPIC_MODEL.
Actual Behavior
Changes model randomly.
Additional Context
-
13 Comments
I think I am encountering a similar bug on Linux for bedrock as well. I think the issue specifically is that the model for the
Tasktool subagent doesn't respect the model set in the settings. Can you confirm if this is what you are seeing as well?@dimohammed328 it totally makes sense that this would be caused by a subagent as that would explain the ability to resume the conversation with
--resume. How can I verify that the Task tool causes the issue?Unsure, if you're running into the issue, you can check if the last thing claude did was call a
Tasktool. I think you can also ask claude to do something as a subagent task so that would work as well.I can confirm the issue, when a new Task spins up it uses the wrong model name:
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Here's a simple Node.js script that works around the issue for now. Set TARGET_URL to your LiteLLM instance (or point directly to Bedrock) by automatically modifying the url to point to the EU model.
Invoke Claude Code by starting the script then setting
ANTHROPIC_BEDROCK_BASE_URL=http://localhost:8888/bedrockSame issue here. Multiple tools affected by invalid model identifier error:
Tools failing:
(us.anthropic.claude-sonnet-4-20250514-v1:0): 400 The provided model identifier is invalid.`
Environment:
/modelshows correct:apac.anthropic.claude-sonnet-4-20250514-v1:0Tools are using wrong
us.prefix instead ofapac.. Breaks entire subagent system.https://github.com/anthropics/claude-code/issues/4855#issuecomment-3220160458
Undocumented
CLAUDE_CODE_SUBAGENT_MODELenv var works for me. (v1.0.92)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.
Still occurring
This would be nice if it got fixed!
This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.
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.