[BUG] claude -p fails with "tools.3.custom.input_examples: Extra inputs are not permitted"
Open 💬 53 comments Opened Nov 15, 2025 by ecarx-ai-adm
💡 Likely answer: A maintainer (km-anthropic, contributor)
responded on this thread — see the highlighted reply below.
Description
The claude -p command (headless mode) fails immediately with API Error 400 when attempting to execute any prompt.
Error Message
API Error: 400 {"error":{"message":"{\"message\":\"tools.3.custom.input_examples: Extra inputs are not permitted\"}. Received Model Group=claude-sonnet-4-5-20250929\nAvailable Model Group Fallbacks=None","type":"None","param":"None","code":"400"}}
Environment
- Claude Code version: 2.0.42
- OS: macOS (Darwin 25.1.0)
- Model: claude-sonnet-4-5-20250929
- Installation method: Homebrew Cask
Reproduction Steps
claude -p "1+1等于几?" --output-format json
or
claude -p "What is 1+1?" --output-format json --allowedTools ""
Both commands fail with the same error.
Expected Behavior
Should return JSON response with the answer.
Actual Behavior
Immediately fails with API Error 400 before any response is generated. The error indicates that tool index 3 (Grep tool based on session init output) has an input_examples field in its definition that the current Anthropic API doesn't accept.
Additional Context
- Interactive mode works fine - this only affects headless mode (
claude -p) - The error suggests the tool definition schema used by Claude Code 2.0.42 is incompatible with the current API
- From the session init output, tool index 3 corresponds to the Grep tool in the tools array:
["Task","Bash","Glob","Grep",...] - The
input_examplesfield was likely part of tool definitions in an earlier API version but has since been removed or renamed
Session Init Output
{
"tools": ["Task","Bash","Glob","Grep","ExitPlanMode","Read","Edit","Write","NotebookEdit","WebFetch","TodoWrite","BashOutput","KillShell","Skill","SlashCommand"],
"model": "claude-sonnet-4-5-20250929",
"claude_code_version": "2.0.42"
}
Impact
This completely breaks headless mode functionality, preventing any programmatic use of Claude Code from scripts or automation workflows.
53 Comments
Update: Interactive Mode Also Affected
The issue is not limited to headless mode (
claude -p). Interactive mode is also experiencing the same error, which means this is a critical bug affecting all functionality of Claude Code 2.0.42.Evidence
Another interactive session just failed with the identical error:
Severity
This makes Claude Code 2.0.42 completely unusable - both headless and interactive modes are broken.
Possible Trigger
The error may not occur immediately upon starting an interactive session, but appears during operation, possibly when certain tools are invoked or after some number of interactions.
Further Investigation: Multiple Versions Affected
Tested multiple versions with different API errors:
Version 2.0.42 (current latest)
Version 2.0.37 (Nov 11, 2025)
Both versions fail immediately in headless mode. Interactive mode also experiences the same errors during operation.
Root Cause Analysis
This appears to be an API compatibility issue rather than a version-specific bug. The Anthropic API may have had a breaking change recently (after Nov 11) that makes multiple Claude Code versions incompatible.
Suggested Actions
Impact
This makes Claude Code completely unusable for users on the current API, affecting both:
claude -p)Hi, are you using portkey or any other proxy by any chance? The TL;DR was that the beta header wasn't passed correctly, and we found some proxies stripping it out
As a mitigation, downgrade to 2.0.36.
Solution is to confirm your llm gateway is passing the
anthropic-betaheader through.Even after downgrading, it still doesn't work for me. I'm still encountering the same issue. I use litellm proxy.
Double check that your llm gateway is passing through the
anthropic-betaheader (if Claude Code is calling Anthropic or Vertex format endpoints) oranthropic_betabody parameter (if Claude Code is calling Bedrock format endpoints) specified by Claude Code.Please share the error you're receiving after downgrading to Claude Code 2.0.36.
It is some what random. I tested, 36, 37, and 42 in the following order in the same shell:
I started the version using ( ~/.local/share/claude/versions/2.0.36, etc ), then one prompt: "what model are you?", then quit.
@ant-kurt Sorry, i must have tested it wrong. it works with 2.0.36
can confirm it works with 2.0.36, but not with 2.0.42 - using litellm proxy to target aws bedrock anthropic models.
problem appears to be in claude code sending
tools[].input_exampleswhich breaks litellm proxylitellm test setup and full details here: https://github.com/BerriAI/litellm/issues/16679#issuecomment-3540754874
I am experiencing this bug as well in 2.0.42 on a corporate account, but not on my personal account.
Environment:
Bug Description:
After a clean install, on the second run, Claude Code fails with:
``
API Error: 400 tools.3.custom.input_examples: Extra inputs are not permitted``Root Cause:
The ~/.claude/statsig/statsig.cached.evaluations file causes Claude Code to register a custom tool with "input_examples" field that the Anthropic API rejects.
Reproduction Steps:
Workaround:
Delete ~/.claude/statsig/statsig.cached.evaluations.* before each run
See my tests above, I didn't uninstall or install anything, or delete any files. 42 works fine now
Yes, I also encountered this problem. After I deleted the ".claude.json" file, it worked properly!
can somebody tell me which anthropic-beta header value I should use?
The
anthropic-betaheader value is determined by Claude Code, and LLM gateways need to forward it as is.For folks still running into this issue after confirming their gateway is forwarding that header, please share your: Claude Code version; LLM gateway name; API provider (Anthropic, Bedrock, Vertex); API format exposed to Claude Code by gateway.
See https://code.claude.com/docs/en/llm-gateway#gateway-requirements
i'm having the exact same issue, i have to close and start a new session after i delete ~/.claude/statsig/statsig.cached.evaluations.*
<img width="1741" height="90" alt="Image" src="https://github.com/user-attachments/assets/600b1b36-8808-42e1-9a8c-1eabeec98a6e" />
Hi @ant-kurt and @km-anthropic glad that you use portkey internally at anthropic xd!
we've made a fix to properly forward the
anthropic-betaandanthropic-versionheaders when using claude code and this will be available generally in the next releasehttps://github.com/Portkey-AI/gateway/pull/1433
Even after passing
anthropic-betaheader from our custom gateway I get this error.``
400 {"type":"error","error":{"type":"invalid_request_error","message":"Unexpected value(s)tool-examples-2025-10-29for theanthropic-betaheader. Please consult our documentation at docs.anthropic.com or try again without the header."},"request_id":"req_vrtx_011CVF6yr86v8a6kvXC59JBA"}``I'm using Claude through VertexAI with the API version
vertex-2023-10-16I also experienced the same issue with the version 44.
The workaround suggested by @theryananderson fixed it for me:
If you're running into
Unexpected value(s) for the anthropic-beta headerwhile using a gateway that sends traffic to Bedrock or Vertex, try setting environment variableCLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1. We added this in Claude Code v2.0.45.cool product bro! everytime i start it i need to do 1hr of troubleshooting... refund my subscription incoming! #dirtbags
Nice, that works. But what cool experimental beta features would we be missing out on? :D
In my opinion experimental betas should be disabled by default & enabled only if user opts in.
@ant-kurt with 2.0.46 and the env set I get the following error:
until I clean the statsig folder on every run:
rm -rf ~/.claude/statsig && claude.@bocytko how are you setting the env var? Is it the same as https://github.com/anthropics/claude-code/issues/11960?
@szwang I see that #11960 was closed. Is this expected behavior or are you wrapping this open issue fix with that issue?
@szwang yes:
But we identified in #11960 this does not working in the
settings.jsonThere was an issue related to settings.json loading of this variable - the fix should be available in the next couple days.
Added env CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 to ~/.zshrc seems fixed issue to me. What I not get is: why in stable product we have beta experiments enabled by default? It should be vice versa: who wants beta experiments must enable it manually, everyone else using stable product, which is tested to work properly.
How do you set that env variable if using claude code extension in VsCode ?
This is back in 2.0.50 (Claude Code), tried env variables but still there.
In VSCode's extension "Claude-code: Environment Variables" settings.json
{
"claudeCode.environmentVariables": [
{"name": "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS", "value":"1"}
]
}
I downgrade from 2.0.50 to 2.0.36,
Additionally i add CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1.
However it still doesnt work.
Was facing the same issue. Downgrading to 2.0.36 worked for me.
Using 2.0.50 in cli and vs code extension. No issues once
CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1is setHi all, is there a way where we can disable claude code to send
anthropic-betaheader at all? I tried in latest version of claude code and already useCLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1and persist it in my shell or~/.claude/settings.jsonnone of them are work, they are still sending theanthropic-betaheaderSave my life. Thanks!
I downgrade from 2.0.50 to 2.0.36, set CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 and still doesn't work for me. I also tried to remove cache from ~/.claude/statsig/ . There's any workaround beyond these?
None of the fixes listed on this page worked for me except for this one. I am on version 2.0.56.
The following combination of fixes worked for me:
~/.claude.jsonexport CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1in my~/.zshrcI tried other permutations of the above three and had no luck.
For what its worth, deleting the
userIDproperty in the.claude.jsonmakes the error go away for me.claudegenerates a new one at the next invocation and appears to have no other effect.At least its preferable to deleting the entire
.claude.jsonfile.This works for me! Yay!
@KaranErry @oscarprabhakar @fcruzjw
Sorry for tagging you all, but can anyone please tell me where to find this ~/.claude.json
Here is what I see in my .claude directory
<img width="1920" height="1080" alt="Image" src="https://github.com/user-attachments/assets/f4034db3-eea9-48ab-bbee-e533ccb9d73d" />
It's not in the
.claudedirectory, but one level higher.It would be located at the root of your user folder
/Users/your-username/.claude.jsonor~/.claude.jsonThis issue still persists. I am using LiteLLM to proxy to the Claude Sonnet 4.5 model on AWS Bedrock.
However, Claude Code execution failed with an error:
LiteLLM failed with an error:
litellm-1 | {"message": "litellm.proxy.proxy_server.anthropic_response(): Exception occured - {\"message\":\"invalid beta flag\"}", "level": "ERROR", "timestamp": "2025-12-28T16:09:00.847664", "stacktrace": "Traceback (most recent call last):\n File \"/usr/lib/python3.13/site-packages/litellm/llms/custom_httpx/llm_http_handler.py\", line 1893, in async_anthropic_messages_handler\n response = await async_httpx_client.post(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n ...<5 lines>."}This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
It does still occuring. Please fix it already! Make default behaviour to not include beta features.
Had the same issue with v2.1.23, set
CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1in settings.json file or set in terminal runtime no longer works.<img width="1499" height="440" alt="Image" src="https://github.com/user-attachments/assets/5ce4c9e2-0aae-4c9e-aa34-7f35c3623f6c" />
It's working.
Facing same issue:
When using Claude Code with
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1enabled, requests to Anthropic fail with:tools.8.custom.defer_loading: Extra inputs are not permitted
I encountered the same issue, with latest version: 2.1.69(even if I set
CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1):I downgraded to 2.1.66 and it works with this version.
The
input_examples: Extra inputs are not permittederror occurs when the API rejects tool definitions that include example fields not supported by the model endpoint you're using.Workaround 1 — Update Claude Code:
This error was common in earlier versions (2.0.x) where tool definitions included
input_examplesfields that some API endpoints reject. Newer versions have fixed the tool schema.Workaround 2 — Switch to a supported model:
The error message mentions
claude-sonnet-4-5-20250929— if this is an older model version, the tool schema may be incompatible.Workaround 3 — Use direct API instead of proxy:
If you're using a proxy or custom API endpoint, the error may come from the proxy rejecting the tool schema. Check your
ANTHROPIC_BASE_URLor API configuration:If using AWS Bedrock or Google Vertex, the tool schema requirements differ from the direct Anthropic API.
Workaround 4 — Disable MCP tools for headless mode:
MCP tools add extra tool definitions. If an MCP server is injecting tools with
input_examples, disabling it may fix the issue:(Check if
--no-mcpis available in your version — if not, temporarily remove MCP servers from settings.json.)