Task tool subagents fail with "x-anthropic-billing-header" error when using Opus model on Bedrock provider

Resolved 💬 4 comments Opened Feb 12, 2026 by PakAbhishek Closed Feb 15, 2026

Bug Description

When spawning a subagent via the Task tool with model: opus while using AWS Bedrock as the provider ("provider": "bedrock" in settings.json), the API returns an error and the subagent fails to start.

Error Message

API Error: 400 x-anthropic-billing-header is a reserved keyword and may not be used in the system prompt.

The subagent never starts — total_tokens: 0, tool_uses: 0.

Reproduction Steps

  1. Configure Claude Code to use Bedrock provider with Opus model:
  • settings.json: "provider": "bedrock", "model": "us.anthropic.claude-opus-4-6-v1"
  • Environment variables: CLAUDE_CODE_USE_BEDROCK=1, AWS_REGION=us-east-1
  1. Spawn any Task agent with model: opus (even a trivial "just say hello" prompt)
  2. Error occurs on ALL agent types: general-purpose, custom agents, etc.

Key Findings from Testing

  • model: haiku on Bedrock: ✅ Works
  • model: sonnet on Bedrock: ✅ Works
  • model: opus on Bedrock: ❌ Fails on ALL agent types
  • The parent session itself runs Opus fine — only Task subagent spawning is affected

Expected Behavior

Task subagents should work with Opus on Bedrock, same as haiku/sonnet.

Root Cause Hypothesis

The Task tool's subagent spawning code path appears to serialize x-anthropic-billing-header into the system prompt content instead of passing it as an HTTP header when the target model is Opus on Bedrock. Haiku and Sonnet likely use a different routing path that handles this correctly.

Environment

  • OS: Windows 11 (10.0.26200)
  • Tool: Claude Code CLI
  • Provider: AWS Bedrock
  • Model: us.anthropic.claude-opus-4-6-v1 (Opus 4.6)
  • AWS Region: us-east-1

Workaround

Use model: sonnet for Task agents until this is fixed.

Additional Context

This appears to be specific to the subagent spawning mechanism when using Bedrock's Opus model. The same configuration works fine for the main Claude Code session, suggesting the issue is in how the Task tool constructs API requests for Opus specifically on the Bedrock provider.

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗