Skip to content

[BUG][Bedrock] Agent Teams teammates spawned with non-Bedrock model ID via --model flag, causing 400 errors #23561

@boxp

Description

@boxp

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

When using Agent Teams with AWS Bedrock, teammates spawned via the Task tool always fail with 400 The provided model identifier is invalid.

The root cause: Claude Code spawns teammates in tmux panes with --model claude-opus-4-6 (Anthropic API format) instead of the Bedrock-qualified model ID us.anthropic.claude-opus-4-6-v1. The --model CLI flag is hardcoded from the team config's model field, which stores the API-format name regardless of the Bedrock environment.

Key observations:

  • The parent/lead process correctly uses Bedrock with ANTHROPIC_MODEL=us.anthropic.claude-opus-4-6-v1
  • The team config stores "model": "claude-opus-4-6" (API format) for each teammate
  • The spawn command passes --model claude-opus-4-6 explicitly
  • The child process shows claude-opus-4-6 · API Usage Billing (not Bedrock) despite CLAUDE_CODE_USE_BEDROCK=1 being available in the tmux global environment
  • Setting tmux global environment variables (tmux set-environment -g) does not help because the --model CLI flag appears to take precedence over env vars

Note: The similar issue for regular Task subagents (#15907, #21235) was fixed, but Agent Teams uses a different code path for spawning teammates that still has this problem.

What Should Happen?

When CLAUDE_CODE_USE_BEDROCK=1 is set, Agent Teams should:

  1. Store the Bedrock-qualified model ID in the team config (e.g., us.anthropic.claude-opus-4-6-v1 instead of claude-opus-4-6)
  2. OR map the model alias (e.g., opus) to the Bedrock model ID using ANTHROPIC_DEFAULT_OPUS_MODEL when generating the --model flag for the spawn command
  3. OR ensure the child process respects CLAUDE_CODE_USE_BEDROCK=1 from the environment even when --model is provided with an API-format name

Error Messages/Logs

API Error (claude-opus-4-6): 400 The provided model identifier is invalid.

Spawn command observed in tmux pane:

cd /path/to/repo && CLAUDECODE=1 CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 \
  /path/to/claude \
  --agent-id anime-otaku@team-name \
  --agent-name anime-otaku \
  --team-name team-name \
  --agent-color blue \
  --parent-session-id <uuid> \
  --agent-type general-purpose \
  --permission-mode acceptEdits \
  --model claude-opus-4-6

Team config showing API-format model:

{
  "agentId": "anime-otaku@team-name",
  "name": "anime-otaku",
  "model": "claude-opus-4-6",
  "backendType": "tmux"
}

Steps to Reproduce

  1. Configure Claude Code for AWS Bedrock:
{
  "env": {
    "CLAUDE_CODE_USE_BEDROCK": "1",
    "AWS_REGION": "us-west-2",
    "ANTHROPIC_MODEL": "us.anthropic.claude-opus-4-6-v1",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "us.anthropic.claude-opus-4-6-v1",
    "AWS_PROFILE": "claude",
    "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
  },
  "teammateMode": "tmux"
}
  1. Create a team with TeamCreate
  2. Spawn a teammate using the Task tool with team_name parameter
  3. Observe the teammate's tmux pane showing claude-opus-4-6 · API Usage Billing and 400 The provided model identifier is invalid

Related Issues

Claude Model

Opus

Is this a regression?

No, this never worked

Last Working Version

No response

Claude Code Version

v2.1.33

Platform

AWS Bedrock

Operating System

macOS

Terminal/Shell

Other

Additional Information

The in-process teammate mode workaround is also blocked by #23437 (in-process setting is ignored when running from tmux, always falls back to tmux panes).

Metadata

Metadata

Assignees

No one assigned

    Labels

    api:bedrockIssue relates to AWS Bedrockarea:modelarea:toolsbugSomething isn't workinghas reproHas detailed reproduction stepsplatform:macosIssue specifically occurs on macOS

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions