[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_examples field 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.

View original on GitHub ↗

53 Comments

ecarx-ai-adm · 8 months ago

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:

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"}}

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.

ecarx-ai-adm · 8 months ago

Further Investigation: Multiple Versions Affected

Tested multiple versions with different API errors:

Version 2.0.42 (current latest)

tools.3.custom.input_examples: Extra inputs are not permitted

Version 2.0.37 (Nov 11, 2025)

invalid beta flag

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

  1. Check if there were recent breaking changes to the Anthropic API
  2. Consider releasing a hotfix version that's compatible with the current API
  3. Add API version pinning or compatibility checks to prevent this in the future

Impact

This makes Claude Code completely unusable for users on the current API, affecting both:

  • Headless mode (claude -p)
  • Interactive mode (errors during operation)
km-anthropic contributor · 8 months ago

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

ant-kurt collaborator · 8 months ago

As a mitigation, downgrade to 2.0.36.

Solution is to confirm your llm gateway is passing the anthropic-beta header through.

gstachniukrsk · 8 months ago

Even after downgrading, it still doesn't work for me. I'm still encountering the same issue. I use litellm proxy.

ant-kurt collaborator · 8 months ago

Double check that your llm gateway is passing through the anthropic-beta header (if Claude Code is calling Anthropic or Vertex format endpoints) or anthropic_beta body 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.

yhan1-godaddy · 8 months ago

It is some what random. I tested, 36, 37, and 42 in the following order in the same shell:

  1. 36, works
  2. 37, works
  3. 42, error
  4. 37, error
  5. 36, works
  6. 37, works
  7. 42, works

I started the version using ( ~/.local/share/claude/versions/2.0.36, etc ), then one prompt: "what model are you?", then quit.

gstachniukrsk · 8 months ago

@ant-kurt Sorry, i must have tested it wrong. it works with 2.0.36

mzagar · 8 months ago

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_examples which breaks litellm proxy

litellm test setup and full details here: https://github.com/BerriAI/litellm/issues/16679#issuecomment-3540754874

theryananderson · 8 months ago

I am experiencing this bug as well in 2.0.42 on a corporate account, but not on my personal account.

Environment:

  • Claude Code Version: 2.0.42
  • OS: macOS
  • Node: v23.9.0

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:

  1. Fresh install Claude Code
  2. Run 'claude "test"' - works
  3. Exit with /exit
  4. Run 'claude "test"' again - fails with API Error 400

Workaround:

Delete ~/.claude/statsig/statsig.cached.evaluations.* before each run

yhan1-godaddy · 8 months ago

See my tests above, I didn't uninstall or install anything, or delete any files. 42 works fine now

asxez · 8 months ago

Yes, I also encountered this problem. After I deleted the ".claude.json" file, it worked properly!

joehyunkim5 · 8 months ago

can somebody tell me which anthropic-beta header value I should use?

ant-kurt collaborator · 8 months ago

The anthropic-beta header 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

ttaatoo · 8 months ago
I am experiencing this bug as well in 2.0.42 on a corporate account, but not on my personal account. ### Environment: Claude Code Version: 2.0.42 OS: macOS Node: v23.9.0 ### 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: 1. Fresh install Claude Code 2. Run 'claude "test"' - works 3. Exit with /exit 4. Run 'claude "test"' again - fails with API Error 400 ### Workaround: Delete ~/.claude/statsig/statsig.cached.evaluations. before each run

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" />

narengogi · 8 months ago

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-beta and anthropic-version headers when using claude code and this will be available generally in the next release
https://github.com/Portkey-AI/gateway/pull/1433

cooldudeachyut · 8 months ago

Even after passing anthropic-beta header from our custom gateway I get this error.

``400 {"type":"error","error":{"type":"invalid_request_error","message":"Unexpected value(s) tool-examples-2025-10-29 for the anthropic-beta header. 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-16

Cayan · 8 months ago

I also experienced the same issue with the version 44.

The workaround suggested by @theryananderson fixed it for me:

Delete ~/.claude/statsig/statsig.cached.evaluations.* before each run
ant-kurt collaborator · 8 months ago

If you're running into Unexpected value(s) for the anthropic-beta header while using a gateway that sends traffic to Bedrock or Vertex, try setting environment variable CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1. We added this in Claude Code v2.0.45.

lmno100 · 8 months ago

cool product bro! everytime i start it i need to do 1hr of troubleshooting... refund my subscription incoming! #dirtbags

yhan1-godaddy · 7 months ago
If you're running into Unexpected value(s) for the anthropic-beta header while using a gateway that sends traffic to Bedrock or Vertex, try setting environment variable CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1. We added this in Claude Code v2.0.45.

Nice, that works. But what cool experimental beta features would we be missing out on? :D

cooldudeachyut · 7 months ago

In my opinion experimental betas should be disabled by default & enabled only if user opts in.

bocytko · 7 months ago
If you're running into Unexpected value(s) for the anthropic-beta header while using a gateway that sends traffic to Bedrock or Vertex, try setting environment variable CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1. We added this in Claude Code v2.0.45.

@ant-kurt with 2.0.46 and the env set I get the following error:

API Error: 400 {"error":{"message":"{\"message\":\"context_management.edits.0: Input tag 'clear_thinking_20251015' found using 'type' does not
    match any of the expected tags: 'clear_tool_uses_20250919'\"}

until I clean the statsig folder on every run: rm -rf ~/.claude/statsig && claude.

szwang · 7 months ago

@bocytko how are you setting the env var? Is it the same as https://github.com/anthropics/claude-code/issues/11960?

STeveShary · 7 months ago

@szwang I see that #11960 was closed. Is this expected behavior or are you wrapping this open issue fix with that issue?

bocytko · 7 months ago
@bocytko how are you setting the env var? Is it the same as #11960?

@szwang yes:

cat ~/.claude/settings.json
{
  "env": {
    "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1",
...
  }
}
STeveShary · 7 months ago
> @bocytko how are you setting the env var? Is it the same as #11960? @szwang yes: `` cat ~/.claude/settings.json { "env": { "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1", ... } } ``

But we identified in #11960 this does not working in the settings.json

ant-kurt collaborator · 7 months ago

There was an issue related to settings.json loading of this variable - the fix should be available in the next couple days.

cherviakovtaskworld · 7 months ago

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.

innoratu · 7 months ago

How do you set that env variable if using claude code extension in VsCode ?

ibeex · 7 months ago

This is back in 2.0.50 (Claude Code), tried env variables but still there.

zilingzhang · 7 months ago
How do you set that env variable if using claude code extension in VsCode ?

In VSCode's extension "Claude-code: Environment Variables" settings.json
{
"claudeCode.environmentVariables": [
{"name": "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS", "value":"1"}
]
}

raleks-accoustic · 7 months ago

I downgrade from 2.0.50 to 2.0.36,
Additionally i add CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1.

However it still doesnt work.

Raaghav-Arya · 7 months ago

Was facing the same issue. Downgrading to 2.0.36 worked for me.

yhan1-godaddy · 7 months ago

Using 2.0.50 in cli and vs code extension. No issues once CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 is set

irfansofyana · 7 months ago

Hi all, is there a way where we can disable claude code to send anthropic-beta header at all? I tried in latest version of claude code and already use CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 and persist it in my shell or ~/.claude/settings.json none of them are work, they are still sending the anthropic-beta header

youguanxinqing · 7 months ago
Added env CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 t

Save my life. Thanks!

fcruzjw · 7 months ago

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?

jeffreysaied · 7 months ago
Yes, I also encountered this problem. After I deleted the ".claude.json" file, it worked properly!

None of the fixes listed on this page worked for me except for this one. I am on version 2.0.56.

KaranErry · 7 months ago

The following combination of fixes worked for me:

  • No longer downgrading CC (I’m now on 2.0.56)
  • Deleting my ~/.claude.json
  • Putting export CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 in my ~/.zshrc

I tried other permutations of the above three and had no luck.

oscarprabhakar · 7 months ago

For what its worth, deleting the userID property in the .claude.json makes the error go away for me.

claude generates a new one at the next invocation and appears to have no other effect.

At least its preferable to deleting the entire .claude.json file.

fcruzjw · 7 months ago
The following combination of fixes worked for me: No longer downgrading CC (I’m now on 2.0.56) Deleting my ~/.claude.json * Putting export CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 in my ~/.zshrc I tried other permutations of the above three and had no luck.

This works for me! Yay!

abdallahsoliman00 · 7 months ago

@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" />

JvE-iO · 7 months ago
@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

It's not in the .claude directory, but one level higher.

farshadtx · 7 months ago
@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 It's not in the .claude directory, but one level higher.

It would be located at the root of your user folder /Users/your-username/.claude.json or ~/.claude.json

Caixiaopig · 6 months ago

This 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:

API Error: 400 {"error":{"message":"{\"message\":\"invalid beta flag\"}. Received Model Group=claude-sonnet-4-5-20250929\nAvailable Model Group
Fallbacks=None","type":"None","param":"None","code":"400"}}

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>."}

github-actions[bot] · 5 months ago

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.

cherviakovtaskworld · 5 months ago

It does still occuring. Please fix it already! Make default behaviour to not include beta features.

michaelnny · 5 months ago

Had the same issue with v2.1.23, set CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 in settings.json file or set in terminal runtime no longer works.

ant-on-elephants · 5 months ago
Had the same issue with v2.1.23, set CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 in 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.

sapEmilJiang · 4 months ago

Facing same issue:
When using Claude Code with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 enabled, requests to Anthropic fail with:
tools.8.custom.defer_loading: Extra inputs are not permitted

chreniuc · 4 months ago

I encountered the same issue, with latest version: 2.1.69(even if I set CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1):

API Error: 400 {"error":{"message":"{\"message\":\"tools.0.custom.defer_loading: Extra inputs are not permitted\"}. Received Model
     Group=claude-opus-4-6\nAvailable Model Group Fallbacks=None","type":"None","param":"None","code":"400"}}

I downgraded to 2.1.66 and it works with this version.

yurukusa · 3 months ago

The input_examples: Extra inputs are not permitted error 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:

claude --update

This error was common in earlier versions (2.0.x) where tool definitions included input_examples fields that some API endpoints reject. Newer versions have fixed the tool schema.
Workaround 2 — Switch to a supported model:

claude -p "your prompt"
claude -p --model claude-sonnet-4-5-20250514 "your prompt"

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_URL or API configuration:

echo $ANTHROPIC_BASE_URL
claude auth status

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:

claude -p --no-mcp "your prompt" 2>/dev/null || claude -p "your prompt"

(Check if --no-mcp is available in your version — if not, temporarily remove MCP servers from settings.json.)