Repository navigation
Description
Description
When using agent teams with AWS Bedrock (CLAUDE_CODE_USE_BEDROCK=1), teammates spawned via tmux do not use the Bedrock model ARN configured through ANTHROPIC_DEFAULT_*_MODEL environment variables. Instead, they default to canonical Anthropic model IDs (e.g., claude-opus-4-6) which fail against the Bedrock endpoint.
Environment
- Claude Code with
CLAUDE_CODE_USE_BEDROCK=1 teammateMode: "tmux"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1- Model configured via
settings.jsonenv block:{ "ANTHROPIC_MODEL": "arn:aws:bedrock:us-west-2:XXXX:application-inference-profile/XXXX", "ANTHROPIC_DEFAULT_OPUS_MODEL": "arn:aws:bedrock:us-west-2:XXXX:application-inference-profile/XXXX", "ANTHROPIC_DEFAULT_SONNET_MODEL": "arn:aws:bedrock:us-west-2:XXXX:application-inference-profile/XXXX", "ANTHROPIC_DEFAULT_HAIKU_MODEL": "arn:aws:bedrock:us-west-2:XXXX:application-inference-profile/XXXX" }
Steps to Reproduce
- Configure Claude Code for Bedrock with env overrides in
settings.json - Enable agent teams:
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1,teammateMode: "tmux" - Create a team with
TeamCreate - Spawn teammates using
Tasktool withteam_nameparameter (without specifyingmodel) - Observe the team config file at
~/.claude/teams/<team-name>/config.json
Expected Behavior
Teammates should resolve the model through the same ANTHROPIC_DEFAULT_*_MODEL env var chain and use the Bedrock ARN, matching the team lead's model resolution.
Actual Behavior
- Team lead correctly uses:
arn:aws:bedrock:us-west-2:XXXX:application-inference-profile/XXXX - Teammates default to:
claude-opus-4-6 - Teammates fail with API errors because
claude-opus-4-6is not valid for the Bedrock endpoint
From the team config:
{
"members": [
{
"name": "team-lead",
"model": "arn:aws:bedrock:us-west-2:XXXX:application-inference-profile/XXXX" // correct
},
{
"name": "sysinfo-agent",
"model": "claude-opus-4-6" // wrong - should be Bedrock ARN
}
]
}Analysis
The teammate spawning logic appears to resolve the model to its canonical Anthropic name (claude-opus-4-6) before checking the ANTHROPIC_DEFAULT_*_MODEL env var overrides. The env vars set in settings.json may not be propagated to the tmux panes where teammates run.
Workaround
TBD - exporting env vars in shell profile may help if tmux panes source the profile.
🤖 Generated with Claude Code
Activity
github-actions commentedon Feb 28, 2026
Found 1 possible duplicate issue:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
GingerJiang714 commentedon Feb 28, 2026
This is not a duplicate of #23561. While both involve Bedrock model resolution for agent teams, the root cause and fix scope are different:
us.anthropic.claude-opus-4-6-v1)arn:aws:bedrock:...:application-inference-profile/...)--modelflag hardcodes API-format name instead of Bedrock-qualified IDANTHROPIC_DEFAULT_*_MODELenv var overrides are not propagated to teammate processes; model resolution ignores env var chainANTHROPIC_DEFAULT_*_MODELenv vars to tmux panes and resolve through the env var chain before writing to team configEven if #23561's proposed fix (mapping
claude-opus-4-6→us.anthropic.claude-opus-4-6-v1) is implemented, it would not solve this issue, because custom application inference profile ARNs cannot be derived from model name mapping alone — they must come from theANTHROPIC_DEFAULT_*_MODELenvironment variables.This is a separate bug in the env propagation / model resolution path for agent team teammates.
GingerJiang714 commentedon Mar 1, 2026
Workaround Found
After deep-diving into the minified
cli.jssource, I found the root cause and a working local patch.Root Cause
In the teammate spawning function (
KZYin minified code), the default model for teammates is set by:Where
XvA = aA1.firstPartywhich resolves to the hardcoded string"claude-opus-4-6". When no model is explicitly specified for a teammate, this default is used and passed as--model claude-opus-4-6on the CLI command to the tmux pane.The teammate process receives this literal model name via the
--modelCLI flag, which bypasses theANTHROPIC_DEFAULT_OPUS_MODELenv var resolution (theib()function that checks env vars is only called when resolving aliases like"opus", not when a full model name is provided directly).Fix (local patch to cli.js)
Apply two patches to
/opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js(or equivalent path):Patch 1 — Change the default teammate model from the hardcoded name to the alias:
sed -i.bak 's/XvA=aA1\.firstParty/XvA="opus"/' cli.jsThis changes the default from
"claude-opus-4-6"to"opus". When the teammate receives--model opus, it resolves throughib()→ checksprocess.env.ANTHROPIC_DEFAULT_OPUS_MODEL→ uses the Bedrock ARN.Patch 2 — Fix the Task tool's model alias map:
This ensures that when a user explicitly passes
model: "opus"in the Task tool, it stays as the alias rather than being expanded to the Anthropic API name.Prerequisites
The teammate's shell environment must have the
ANTHROPIC_DEFAULT_OPUS_MODELenv var set (e.g., via.zshrcsourcing credentials). This is needed so the teammate process can resolve"opus"→ Bedrock ARN.Result
--model claude-opus-4-6→ 400 error on Bedrock--model opus→ resolved via env var to Bedrock ARN → worksNote
These patches are overwritten on
npm update. Re-apply after upgrading Claude Code. One-liner:Suggested Proper Fix
The teammate spawning code should either:
"opus") instead of the resolved model name, letting each teammate resolve it via its own env varsib()/ok()/t_()at spawn time (which checksANTHROPIC_DEFAULT_*_MODELenv vars) and pass the Bedrock ARN directlyjrgleason commentedon Mar 6, 2026
@GingerJiang714 Do you have any idea what the workaround would look like for windows? I think the js file is in the exe
jrgleason commentedon Mar 9, 2026
Any update? This is causing major issues for the people in my company given no mitigation listed for Windows. Also due to it being proprietary in the part creating the EXE I couldn't fix it directly from the Claude Code source. Claude code said it would require change to the closed source portion.
MasterXue commentedon Mar 10, 2026
https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md#2172
2.1.72 fix the bug, but I haven't verified it yet.
MasterXue commentedon Mar 10, 2026
I tested it and I'm sure it didn't fix it.
jrgleason commentedon Mar 10, 2026
Also to be clear I am using
--model opusplannotopusMasterXue commentedon Mar 12, 2026
v2.1.74 maybe fix it, i tested it
jrgleason commentedon Mar 12, 2026
@MasterXue Just tried and no dice still see
MasterXue commentedon Mar 12, 2026
Indeed, someone have reported that there are still problems, and I need to check it again.
jrgleason commentedon Mar 12, 2026
Actually I removed Oh My claude code to make sure that wasn't the issue and it looks like it is working on that version as well. I will focus on them.
East-rayyy commentedon Mar 16, 2026
@GingerJiang714 — this is exactly the problem I solved. The root cause is that
ANTHROPIC_DEFAULT_*_MODELenv vars from settings.json aren't loaded until after the alias resolver builds its lookup tables at module init. So Bedrock ARNs never make it to the resolver.claude-alias-patch fixes this chicken-and-egg timing issue by overriding the env var whitelist and adding a fallback resolver. Your Bedrock ARNs will be resolved correctly for both the main session and teammates.
Single install script — auto-patches your instance. No re-patching needed when you change model ARNs.
GingerJiang714 commentedon Mar 18, 2026
@East-rayyy Thanks for providing the script, I will try it out.
github-actions commentedon Apr 15, 2026
Closing for now — inactive for too long. Please open a new issue if this is still relevant.
github-actions commentedon Apr 23, 2026
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.