Bedrock: subagent model alias ignores ANTHROPIC_DEFAULT_SONNET_MODEL, forces invalid eu.<model> profile

Open 💬 0 comments Opened Jul 2, 2026 by Bardioc1977

What happens

On Amazon Bedrock, the main loop correctly runs Sonnet 5 via ANTHROPIC_DEFAULT_SONNET_MODEL pointing at a global.anthropic.claude-sonnet-5 inference profile. But spawning a subagent with model: sonnet (either in an agent definition's frontmatter or via the Agent/Task tool's model parameter) does not use that env var. Instead it constructs eu.anthropic.claude-sonnet-5, which the regional endpoint rejects:

API Error: 400 The provided model identifier is invalid..
Try /model to switch to eu.anthropic.claude-sonnet-4-6.

The subagent dies immediately (0 tokens, ~0.5s), so any agent with model: sonnet is effectively unusable — even though the identical model runs fine in the main loop.

Expected

Subagent sonnet/opus/haiku alias resolution should honor the same ANTHROPIC_DEFAULT_*_MODEL env vars (and the inference-profile region prefix) that the main loop uses — or at least not synthesize a region-prefixed profile ID (eu.<model>) that does not exist in the account/region.

Steps to reproduce

  1. Run Claude Code with CLAUDE_CODE_USE_BEDROCK=1 in a region where the global. inference profile for Sonnet 5 is available but eu.anthropic.claude-sonnet-5 is not.
  2. Set the main-loop Sonnet model via ANTHROPIC_DEFAULT_SONNET_MODEL=<...>/global.anthropic.claude-sonnet-5. Main loop works.
  3. Define a subagent with model: sonnet in its frontmatter (or pass model: "sonnet" to the Agent/Task tool).
  4. Spawn it → immediate 400 The provided model identifier is invalid against eu.anthropic.claude-sonnet-5.

Workaround

Put the full inference-profile ARN in the agent's model: frontmatter instead of the sonnet alias, e.g.:

model: arn:aws:bedrock:<region>:<account>:inference-profile/global.anthropic.claude-sonnet-5

Environment

  • Claude Code with CLAUDE_CODE_USE_BEDROCK=1
  • Region where the global. profile is available but the eu.<model> variant is not
  • Main-loop model configured via ANTHROPIC_DEFAULT_SONNET_MODEL

View original on GitHub ↗