Skip to content

Instantly share code, notes, and snippets.

@trhinehart-attentive
Created February 13, 2026 00:14
Show Gist options
  • Select an option

  • Save trhinehart-attentive/0e7fd8f8d636781452a92fa26711e70a to your computer and use it in GitHub Desktop.

Select an option

Save trhinehart-attentive/0e7fd8f8d636781452a92fa26711e70a to your computer and use it in GitHub Desktop.
Workaround: Claude Code Agent Teams broken on AWS Bedrock (#25193)

Workaround: Claude Code Agent Teams Broken on AWS Bedrock

Issue: anthropics/claude-code#25193

Problem

When using Claude Code with AWS Bedrock (CLAUDE_CODE_USE_BEDROCK=1), spawning team agent teammates fails because the Bedrock model identifier (e.g., us.anthropic.claude-opus-4-6-v1) gets normalized to the Anthropic API format (claude-opus-4-6), which Bedrock does not recognize.

This causes all teammate processes to fail with:

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

Root Cause

Claude Code's internal model ID normalization strips the Bedrock prefix (us.anthropic.) and suffix (-v1) when passing the model to teammate subprocesses.

Workaround

We exploit an internal env var CLAUDE_CODE_TEAMMATE_COMMAND that overrides which executable is used when spawning teammates. By pointing it at a wrapper script that rewrites --model args, we intercept and fix the model ID before it reaches the teammate process.

Step 1: Create the wrapper script

cat > ~/.local/bin/claude-bedrock-wrapper << 'SCRIPT'
#!/bin/bash
# Wrapper that rewrites --model args to use the Bedrock model ID.
# Spawned teammates get a normalized model ID (e.g., claude-opus-4-6)
# which Bedrock doesn't recognize. This rewrites it to the full Bedrock ID.
#
# See: https://github.com/anthropics/claude-code/issues/25193

BEDROCK_MODEL="${CLAUDE_BEDROCK_MODEL_OVERRIDE:-us.anthropic.claude-opus-4-6-v1}"
REAL_BINARY="$(readlink -f "$HOME/.local/bin/claude")"

args=()
while [[ $# -gt 0 ]]; do
  if [[ "$1" == "--model" ]]; then
    args+=("--model" "$BEDROCK_MODEL")
    shift 2  # skip the original model value
  else
    args+=("$1")
    shift
  fi
done

exec "$REAL_BINARY" "${args[@]}"
SCRIPT

chmod +x ~/.local/bin/claude-bedrock-wrapper

Step 2: Set the env var

Add to your ~/.zshrc (or ~/.bashrc):

export CLAUDE_CODE_TEAMMATE_COMMAND="$HOME/.local/bin/claude-bedrock-wrapper"

Step 3: Reload your shell

source ~/.zshrc

How It Works

  1. Claude Code checks CLAUDE_CODE_TEAMMATE_COMMAND before using process.execPath when spawning teammates
  2. The wrapper intercepts --model claude-opus-4-6 (or any normalized model) and replaces it with the full Bedrock model ID
  3. Since env vars propagate to child processes, the wrapper is used at every level of spawning — even if a teammate spawns sub-teammates

Customization

To use a different Bedrock model, either:

  • Edit the BEDROCK_MODEL default in the wrapper script, or
  • Set CLAUDE_BEDROCK_MODEL_OVERRIDE in your shell:
    export CLAUDE_BEDROCK_MODEL_OVERRIDE="us.anthropic.claude-sonnet-4-5-20250929-v1:0"

Notes

  • The wrapper resolves the real binary dynamically via the claude symlink, so it survives Claude Code auto-updates
  • This only affects teammate/agent spawning — your main Claude Code session is unaffected
  • Remove the env var to disable the workaround once the upstream fix ships
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment