Custom agents with model: opus fail on Bedrock provider - x-anthropic-billing-header reserved keyword error
Bug Description
Custom agents defined in ~/.claude/agents/*.md that specify model: opus (or inherit Opus from the parent session) fail to spawn when using the Bedrock provider. The error is:
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 with Bedrock provider in
settings.json:
{
"provider": "bedrock",
"model": "us.anthropic.claude-opus-4-6-v1"
}
- Create a custom agent in
~/.claude/agents/my-agent.md:
---
name: my-agent
model: opus
---
You are a helpful agent.
- Spawn the agent via Task tool:
Task(subagent_type="my-agent", prompt="Hello")
Result: API Error: 400 x-anthropic-billing-header is a reserved keyword and may not be used in the system prompt.
What Works vs What Fails
| Scenario | Result |
|----------|--------|
| Custom agent + Bedrock + model: opus | FAILS |
| Custom agent + Bedrock + model: sonnet | Works |
| Custom agent + Bedrock + no model (inherits opus) | FAILS |
| Built-in agent (general-purpose, Explore) + Bedrock + opus | Works |
Root Cause Hypothesis
When spawning custom agents through the Bedrock provider with the Opus model, Claude Code appears to incorrectly inject the x-anthropic-billing-header HTTP header into the system prompt content sent to the Bedrock Converse API. This does not happen with built-in agent types, suggesting the custom agent code path handles Bedrock headers differently.
Workaround
Pass model: sonnet explicitly when spawning custom agents via the Task tool. The custom agent's full system prompt is preserved, just running on Sonnet instead of Opus.
Environment
- Platform: Windows 11
- Provider: Bedrock (
us.anthropic.claude-opus-4-6-v1) - Claude Code version: Latest as of 2026-02-10
- Agent teams feature enabled:
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - All 5 custom agents affected (qa-test-engineer, requirements-guardian, elite-security-auditor, elite-documentation-architect, devops-guardian)
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗