Custom agents in .claude/agents/ fail with 400 error on AWS Bedrock: x-anthropic-billing-header reserved keyword

Resolved 💬 4 comments Opened Feb 11, 2026 by yoniadir Closed Feb 15, 2026

Bug Description

Custom agents defined in .claude/agents/ fail to spawn when Claude Code is configured to use AWS Bedrock. The error occurs immediately on agent launch with zero tokens consumed.

Error Message

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

Environment

  • Claude Code version: Latest (CLI)
  • Model: us.anthropic.claude-opus-4-6-v1 via AWS Bedrock
  • OS: macOS (Darwin 25.2.0)
  • Node: v22.14.0

Configuration

~/.claude/settings.json:

{
  "env": {
    "AWS_PROFILE": "claude-code",
    "CLAUDE_CODE_USE_BEDROCK": "true"
  },
  "model": "us.anthropic.claude-opus-4-6-v1"
}

Steps to Reproduce

  1. Configure Claude Code to use AWS Bedrock (CLAUDE_CODE_USE_BEDROCK=true)
  2. Create a custom agent in .claude/agents/ (e.g., .claude/agents/my-agent.md) with any valid agent definition
  3. Trigger the agent via the Task tool (either directly or through a slash command that invokes it)

Expected Behavior

The custom agent should spawn and execute normally, the same way it does when using the Anthropic API directly.

Actual Behavior

The agent immediately fails with:

API Error: 400 x-anthropic-billing-header is a reserved keyword and may not be used in the system prompt.
agentId: <id> (for resuming to continue this agent's work if needed)
<usage>total_tokens: 0, tool_uses: 0</usage>

No tokens are consumed. The agent never starts execution.

Analysis

When Claude Code spawns a sub-agent via the Task tool, it constructs a new API request with a composed system prompt. It appears that x-anthropic-billing-header metadata is being included in the system prompt content. The Anthropic API accepts this, but the Bedrock API rejects it as a reserved keyword.

Built-in agent types (Explore, Bash, Plan, general-purpose, etc.) work correctly on Bedrock — only custom agents defined in .claude/agents/ are affected.

Workaround

None currently. Custom agents cannot be used with Bedrock. Users must fall back to built-in agent types or switch to the Anthropic API directly.

View original on GitHub ↗

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