[BUG] [bedrock] Subagent `sonnet` alias ignores ANTHROPIC_DEFAULT_SONNET_MODEL and sends an invalid `us.` profile ID (regression of / same as #73556)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Summary
On Amazon Bedrock, when a subagent requests the sonnet alias, Claude Code ignoresANTHROPIC_DEFAULT_SONNET_MODEL and sends a built-in, region-prefixed profile ID
(us.anthropic.claude-sonnet-5-5). Bedrock rejects that ID with a 400 error, and the subagent dies before its first
tool call. The alias can come from agent frontmatter (model: sonnet) or from the Agent tool's model parameter.
The main loop resolves the same alias correctly through the env var. This is the bug reported in #73556, which was
closed as "not planned" after going stale, with no fix or maintainer comment. It still reproduces on 2.1.284.
Environment
- Claude Code 2.1.284 (CLI), Windows 11, Git Bash
~/.claude/settings.jsonenv:
``json``
"CLAUDE_CODE_USE_BEDROCK": "1",
"AWS_REGION": "us-east-1",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "global.anthropic.claude-sonnet-5-5",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "us.anthropic.claude-opus-5-5[1m]"
- No project-level or local settings override any model variable.
envinside the session confirms
ANTHROPIC_DEFAULT_SONNET_MODEL=global.anthropic.claude-sonnet-5-5 is set in the process.
- No
modelOverridesoravailableModelsare configured, so this is separate from #81995.
Reproduction
# 1. Main loop, alias -> works (env var honoured)
claude -p --model sonnet "Reply with only: OK"
# OK
# 2. Main loop, full ID -> works (ID is valid on this account)
claude -p --model global.anthropic.claude-sonnet-5-5 "Reply with only: OK"
# OK
# 3. Subagent, alias -> FAILS
claude -p --agents '{"alias-test":{"description":"test agent","prompt":"Reply with only: SUBAGENT-OK","model":"sonnet"}}' \
"Call the Agent tool with subagent_type alias-test and prompt 'go'. Print its reply or the exact error."
# 4. Subagent, full ID -> works
claude -p --agents '{"fullid-test":{"description":"test agent","prompt":"Reply with only: SUBAGENT-OK","model":"global.anthropic.claude-sonnet-5-5"}}' \
"Call the Agent tool with subagent_type fullid-test and prompt 'go'. Print its reply or the exact error."
# SUBAGENT-OK
A subagent file in .claude/agents/*.md with model: sonnet in its frontmatter fails the same way. So does
calling the Agent tool with model: "sonnet" on a built-in agent type.
Actual result (step 3)
Agent terminated early due to an API error: 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)
Expected result
Subagent alias resolution uses the same ANTHROPIC_DEFAULT_*_MODEL mapping as the main loop, so step 3 sendsglobal.anthropic.claude-sonnet-5-5 and succeeds.
Results matrix
| Path | Model requested | Model sent | Result |
|---|---|---|---|
| Main loop --model | sonnet | env override | OK |
| Main loop --model | global.anthropic.claude-sonnet-5-5 | same | OK |
| Subagent (--agents / frontmatter / Agent tool) | sonnet | us.anthropic.claude-sonnet-5-5 | 400 model_not_found |
| Subagent (--agents) | global.anthropic.claude-sonnet-5-5 | same | OK |
Likely cause (inference, not verified)
The subagent path seems to build the default Bedrock profile from AWS_REGION (us-east-1 -> us.) and never checksANTHROPIC_DEFAULT_SONNET_MODEL. In #73556 an EU region produced eu., which fits this. The opus andhaiku aliases don't fail for us only because their built-in us. IDs happen to be valid on this account. They
may be ignoring their overrides as well, but the error doesn't show.
Impact
- Custom agents pinned to
sonnetfor cost fail hard on Bedrock. Users then switch them toopus, which costs more,
or hard-code provider-specific IDs in agent files. Those files then can't be shared across providers.
- The error message points users at the wrong fix. They edit
settings.json, which is already correct.
Workaround
Put the full provider ID in the agent frontmatter: model: global.anthropic.claude-sonnet-5-5.
---
*Investigated, reproduced and drafted by Claude Opus 5.5 (Claude Code 2.1.284) at the reporter's request; reproduction
steps were run and results recorded on 2026-09-30.*
🤖 Generated with Claude Code
What Should Happen?
Expected result
Subagent alias resolution uses the same ANTHROPIC_DEFAULT_*_MODEL mapping as the main loop, so step 3 sendsglobal.anthropic.claude-sonnet-5-5 and succeeds.
Results matrix
| Path | Model requested | Model sent | Result |
|---|---|---|---|
| Main loop --model | sonnet | env override | OK |
| Main loop --model | global.anthropic.claude-sonnet-5-5 | same | OK |
| Subagent (--agents / frontmatter / Agent tool) | sonnet | us.anthropic.claude-sonnet-5-5 | 400 model_not_found |
| Subagent (--agents) | global.anthropic.claude-sonnet-5-5 | same | OK |
Error Messages/Logs
Agent terminated early due to an API error: 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
Reproduction
# 1. Main loop, alias -> works (env var honoured)
claude -p --model sonnet "Reply with only: OK"
# OK
# 2. Main loop, full ID -> works (ID is valid on this account)
claude -p --model global.anthropic.claude-sonnet-5-5 "Reply with only: OK"
# OK
# 3. Subagent, alias -> FAILS
claude -p --agents '{"alias-test":{"description":"test agent","prompt":"Reply with only: SUBAGENT-OK","model":"sonnet"}}' \
"Call the Agent tool with subagent_type alias-test and prompt 'go'. Print its reply or the exact error."
# 4. Subagent, full ID -> works
claude -p --agents '{"fullid-test":{"description":"test agent","prompt":"Reply with only: SUBAGENT-OK","model":"global.anthropic.claude-sonnet-5-5"}}' \
"Call the Agent tool with subagent_type fullid-test and prompt 'go'. Print its reply or the exact error."
# SUBAGENT-OK
A subagent file in .claude/agents/*.md with model: sonnet in its frontmatter fails the same way. So does
calling the Agent tool with model: "sonnet" on a built-in agent type.
Claude Model
Not sure / Multiple models
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.284
Platform
AWS Bedrock
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
_No response_
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗