[BUG] Subagent spawning fails with model: opus on AWS Bedrock — "x-anthropic-billing-header is a reserved keyword
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?
When using Claude Code with AWS Bedrock (CLAUDE_CODE_USE_BEDROCK=1), spawning subagents (via the Task tool) with model: opus fails with an API 400 error. The same agents work fine with model: sonnet or model: haiku. The main conversation itself runs on opus via Bedrock without issue.
What Should Happen?
Subagents with model: opus should work on AWS Bedrock the same way the main conversation does. The billing header should be sent as an HTTP header, not embedded in the system prompt content.
Error Messages/Logs
API Error: 400 x-anthropic-billing-header is a reserved keyword and may not be used in the system prompt.
Steps to Reproduce
- Configure Claude Code to use AWS Bedrock:
``json``
// .claude/settings.local.json
{
"env": {
"CLAUDE_CODE_USE_BEDROCK": "1",
"AWS_REGION": "us-east-1"
}
}
- Create a custom agent at
.claude/agents/my-agent.md:
``yaml``
---
name: my-agent
description: "A test agent"
model: opus
---
You are a helpful assistant.
- Use the Task tool to spawn the agent:
````
Task(subagent_type="my-agent", prompt="Read any file and return its first line.")
- Result:
API Error: 400 x-anthropic-billing-header is a reserved keyword and may not be used in the system prompt.
- Change the agent to
model: sonnetor passmodel: sonnetas a Task tool parameter — it works.
Test Matrix
| Agent Type | Model | Backend | Result |
|-----------|-------|---------|--------|
| Custom agent | opus (frontmatter) | Bedrock | FAIL |
| Built-in general-purpose | opus (Task param) | Bedrock | FAIL |
| Custom agent | haiku (Task param override) | Bedrock | OK |
| Custom agent | sonnet (Task param override) | Bedrock | OK |
| Built-in mcp-explorer | haiku (frontmatter) | Bedrock | OK |
| Built-in general-purpose | sonnet (Task param) | Bedrock | OK |
| Main conversation | opus | Bedrock | OK |
Root Cause Analysis
Claude Code sends an x-anthropic-billing-header with attribution data on every API call (visible in debug logs):
[DEBUG] attribution header x-anthropic-billing-header: cc_version=2.1.37.3a3; cc_entrypoint=cli; cch=00000;
When spawning opus-model subagents through Bedrock, this header appears to be injected into the system prompt content rather than sent as an HTTP header. Bedrock's API validation rejects requests containing x-anthropic-billing-header as a reserved keyword in the system prompt body.
This does not affect:
- The main conversation (opus on Bedrock works fine)
- Subagents using
model: haikuormodel: sonnet - Direct Anthropic API usage (not Bedrock)
Environment
- Claude Code version: 2.1.37
- API backend: AWS Bedrock (
CLAUDE_CODE_USE_BEDROCK=1) - AWS Region: us-east-1
- Model ID (from config):
us.anthropic.claude-opus-4-6-v1 - OS: Linux (devcontainer, linux/amd64)
- Node.js: 22.x
Workaround
Change model: opus to model: sonnet in custom agent frontmatter (.claude/agents/*.md). Sonnet subagents work correctly on Bedrock.
Expected Behavior
Subagents with model: opus should work on AWS Bedrock the same way the main conversation does. The billing header should be sent as an HTTP header, not embedded in the system prompt content.
Impact
Any custom agent or built-in agent configured to use opus is completely broken on Bedrock deployments. Users must downgrade all subagents to sonnet/haiku as a workaround.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.37
Platform
AWS Bedrock
Operating System
macOS
Terminal/Shell
VS Code integrated terminal
Additional Information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗