[BUG] Bedrock: subagent model alias resolved with the parent session's inference-profile prefix, ignoring ANTHROPIC_DEFAULT_<TIER>_MODEL
What's Wrong?
On Bedrock, a subagent's model alias is resolved with the parent session's inference-profile prefix instead of the configured ANTHROPIC_DEFAULT_<TIER>_MODEL value. When the parent runs on a us. profile and the configured Sonnet model is a global. profile (Sonnet 5.5 has no us. profile in us-east-1), every Sonnet subagent fails at its first call.
What Should Happen?
A subagent with model: sonnet (frontmatter or per-call) should use ANTHROPIC_DEFAULT_SONNET_MODEL exactly as configured, global.anthropic.claude-sonnet-5-5, the same way a top-level claude -p --model sonnet session does.
Error Messages/Logs
API Error (us.anthropic.claude-sonnet-5-5): 400 The provided model identifier is invalid.. Try /model to switch to us.anthropic.claude-sonnet-5. (error type model_not_found, HTTP 400, model sent to the API: us.anthropic.claude-sonnet-5-5)
Steps to Reproduce
- Settings
env:CLAUDE_CODE_USE_BEDROCK=1,AWS_REGION=us-east-1,ANTHROPIC_DEFAULT_OPUS_MODEL=us.anthropic.claude-opus-5-5,ANTHROPIC_DEFAULT_SONNET_MODEL=global.anthropic.claude-sonnet-5-5. - Define a subagent with
model: sonnetin its frontmatter. echo 'Reply with exactly: OK' | claude -p --model sonnet --output-format json: works, andmodelUsageshowsglobal.anthropic.claude-sonnet-5-5.- From a session on
us.anthropic.claude-opus-5-5, dispatch the subagent: it fails with the error above, and the model sent isus.anthropic.claude-sonnet-5-5. - From a session on
global.anthropic.claude-opus-5-5(claude -p --model global.anthropic.claude-opus-5-5 --allowedTools Agent), dispatch the same subagent: it works, andmodelUsageshowsglobal.anthropic.claude-sonnet-5-5.
Workaround: put the session model and all ANTHROPIC_DEFAULT_*_MODEL values on the same prefix.
Claude Model
Opus (parent), Sonnet (subagent)
Is this a regression?
I don't know
Claude Code Version
2.1.286 (Claude Code)
Platform
AWS Bedrock
Operating System
macOS
Terminal/Shell
zsh
Additional Information
This is the bug from #73556 (same symptom with an eu. prefix), which was closed as stale with a request to reopen if it's still relevant. It still reproduces on 2.1.286. The new finding is where the prefix comes from: it is taken from the parent session's model. Step 5 shows that moving the parent to a global. profile makes the same subagent resolve correctly.