API Error: 400 context_management : Extra inputs are not permitted
A gateway forwarded Claude Code's beta-only context_management field without its beta header, or to an upstream such as Bedrock that rejects it. Update to Claude Code v2.1.304.
Summary
- From v2.1.304, Claude Code retries this rejection without the field and leaves it out for the rest of the conversation.
- A defer_loading or tool_reference version of the error needs v2.1.305 or later, which retries without tool search.
- If you run the gateway, forward the anthropic-beta header with the body, or have users set CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1.
- Before v2.1.302, the same error naming diagnostics appeared when an open session moved to Bedrock or Google Cloud; restart that session.
On this page
A beta field arrived without its header
API Error: 400 ... context_management: Extra inputs are not permitted
context_management is a beta request field. Claude Code sends it, like tool search's defer_loading, together with an anthropic-beta header that turns it on. The Claude Code error reference gives two ways it gets rejected: a gateway forwards the body but drops the header, so the API sees a field it does not recognize, or a gateway forwards the Anthropic-format body to an upstream with a different schema. Anthropic's gateway troubleshooting table notes the second is common when a gateway accepts Anthropic-format requests and passes them on to Amazon Bedrock.
Run /status to see the base URL. If it is not Anthropic's API, the gateway is where the field gets lost.
Update Claude Code
claude --version
claude update
From v2.1.304, Claude Code answers this exact rejection by sending the request once more without context_management, and later requests in that conversation leave it out. It recognizes the rejection by its message, so this works only if the gateway passes the upstream's error text through unchanged.
If the message names defer_loading or tool_reference instead, you need v2.1.305 or later; Claude Code then retries without the tool search fields and loads your MCP tools upfront.
If updating does not stop it
Set this before you start Claude Code:
export CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1
It stops Claude Code sending context management, beta tool fields such as strict and defer_loading, structured-output format, task budgets and MCP tool search, with their beta headers. Values you add yourself through ANTHROPIC_BETAS or CLAUDE_CODE_EXTRA_BODY still go out, so check those too.
If you run the gateway, the real fix is to forward the anthropic-beta header together with the body fields it pairs with. The gateway compatibility guide lists each pair, and warns that a gateway that rewrites or redacts request bodies for inspection breaks them just as stripping does.
The diagnostics version
Before v2.1.302, the same error could name diagnostics with no gateway in between. It happened when a session that had used the Anthropic API moved to Amazon Bedrock or Google Cloud's Agent Platform without a restart, for example after running /setup-bedrock in another Claude Code window. Run /clear or restart that session, and update.
A beta header the upstream refuses outright gives invalid beta flag instead, and an effort field stripped by a gateway gives system content must contain at least one block. Other 400s are on our Claude Code API Error 400 page.