[BUG] Custom agents defined in ~/.claude/agents/ fail to spawn when using Bedrock as the API provider.

Resolved 💬 3 comments Opened Feb 12, 2026 by zchboswell Closed Feb 13, 2026

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?

Custom agents defined in ~/.claude/agents/ fail to spawn when using Bedrock as the API provider. Every invocation immediately returns:

API Error: 400 x-anthropic-billing-header is a reserved keyword and may not be used in the system prompt.
The agent never starts (0 tokens, 0 tool uses). The string x-anthropic-billing-header does not appear anywhere in the agent definition, settings, or project config. Built-in agent types (general-purpose, Explore, Plan, etc.) work fine under the same Bedrock setup.

What Should Happen?

Custom agents should spawn and execute normally on Bedrock, the same as built-in agent types.

Error Messages/Logs

API Error: 400 x-anthropic-billing-header is a reserved keyword and may not be used in the system prompt.
agentId: <id>
total_tokens: 0
tool_uses: 0

Steps to Reproduce

Set "apiProvider": "bedrock" in ~/.claude/settings.json
Create a minimal custom agent at ~/.claude/agents/test-agent.md:
---
name: test-agent
description: A test agent.
tools: Read, Glob
---

You are a test agent. Say hello.
From any Claude Code session, invoke via the Task tool:
Task(subagent_type="test-agent", prompt="Say hello")
Observe the 400 error. The agent body content does not matter — any custom agent definition triggers it.
Ruling out user config: grepped all files under ~/.claude/ (agents, settings, settings.local, CLAUDE.md) for x-anthropic and billing-header — zero matches. Also tried removing the model: field from the agent frontmatter — same error.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.39 (Claude Code)

Platform

AWS Bedrock

Operating System

macOS

Terminal/Shell

VS Code integrated terminal

Additional Information

Built-in agent types (general-purpose, Explore, Plan) work without issue under the identical Bedrock configuration.
The error occurs before any agent execution — it's at the API request construction level.
Likely cause: Claude Code injects internal metadata containing the reserved header name into the system prompt when assembling requests for custom agents. Bedrock validates system prompt content against reserved Anthropic header names and rejects the request. This code path appears to differ from the one used for built-in agents.

View original on GitHub ↗

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