claude-code - 💡(How to fix) Fix [BUG] 400 error with custom ANTHROPIC_BASE_URL should suggest CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#46105Fetched 2026-04-11 06:28:53
View on GitHub
Comments
1
Participants
2
Timeline
7
Reactions
0
Author
Timeline (top)
labeled ×5commented ×1cross-referenced ×1

Error Message

API Error: 400 {"type":"error","error":{"type":"invalid_request_error", "message":"Unexpected value(s) advisor-tool-2026-03-01 for the anthropic-beta header. Please consult our documentation at docs.claude.com or try again without the header."},"request_id":"req_011CZudNPFEcZGR8Ace3tPTm"}

Fix Action

Fix / Workaround

The workaround is to set CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1, which suppresses these headers and restores functionality. However, Claude Code gives no indication that this flag exists or is relevant — the user only sees a raw 400 API error.

Workaround: Setting CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 resolves the issue.

Code Example

You appear to be using a custom API endpoint. If you are seeing beta header
errors, set CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 to disable them.

---

API Error: 400 {"type":"error","error":{"type":"invalid_request_error",
"message":"Unexpected value(s) `advisor-tool-2026-03-01` for the
`anthropic-beta` header. Please consult our documentation at docs.claude.com
or try again without the header."},"request_id":"req_011CZudNPFEcZGR8Ace3tPTm"}

---

export ANTHROPIC_BASE_URL="https://<deployment>.services.ai.azure.com/anthropic/"
   export ANTHROPIC_AUTH_TOKEN="<api-key>"
   export ANTHROPIC_MODEL=claude-sonnet-4-6
   export ANTHROPIC_API_KEY=""
   # CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS is NOT set
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report
  • I am using the latest version of Claude Code

What's Wrong?

When using Claude Code with a custom ANTHROPIC_BASE_URL (e.g. Azure AI, LiteLLM, or other gateways), Claude Code v2.1.100 sends beta headers such as advisor-tool-2026-03-01 that the third-party endpoint does not recognize, causing an immediate HTTP 400 failure with a cryptic API error.

The workaround is to set CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1, which suppresses these headers and restores functionality. However, Claude Code gives no indication that this flag exists or is relevant — the user only sees a raw 400 API error.

Related to the pattern in #22893 (same class of issue, new beta header advisor-tool-2026-03-01).

What Should Happen?

When a 400 error is received that contains "Unexpected value(s)" for the anthropic-beta header, and ANTHROPIC_BASE_URL is set to a non-Anthropic endpoint, Claude Code should output a clear, actionable message:

You appear to be using a custom API endpoint. If you are seeing beta header
errors, set CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 to disable them.

Error Messages/Logs

API Error: 400 {"type":"error","error":{"type":"invalid_request_error",
"message":"Unexpected value(s) `advisor-tool-2026-03-01` for the
`anthropic-beta` header. Please consult our documentation at docs.claude.com
or try again without the header."},"request_id":"req_011CZudNPFEcZGR8Ace3tPTm"}

Steps to Reproduce

  1. Configure Claude Code with an Azure AI endpoint:
    export ANTHROPIC_BASE_URL="https://<deployment>.services.ai.azure.com/anthropic/"
    export ANTHROPIC_AUTH_TOKEN="<api-key>"
    export ANTHROPIC_MODEL=claude-sonnet-4-6
    export ANTHROPIC_API_KEY=""
    # CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS is NOT set
  2. Run claude and send any prompt.
  3. Request fails with HTTP 400 — no suggestion that CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 would fix it.

Workaround: Setting CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 resolves the issue.

Is this a regression?

Yes — introduced in v2.1.100 (new advisor-tool-2026-03-01 beta header added without coverage by the disable flag's detection logic).

Claude Code Version

2.1.100

Platform

Linux

Additional Information

The fix could be either:

  1. (Better UX) Detect Unexpected value(s) + anthropic-beta in a 400 response when ANTHROPIC_BASE_URL is custom, and surface a helpful message pointing to CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1.
  2. (Stricter fix) Ensure CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 suppresses all experimental headers including newer ones like advisor-tool-2026-03-01.

extent analysis

TL;DR

Setting CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 resolves the HTTP 400 error caused by unrecognized beta headers when using a custom ANTHROPIC_BASE_URL.

Guidance

  • To immediately resolve the issue, set the CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 environment variable to suppress beta headers.
  • Verify that the error message changes or the request succeeds after applying the workaround.
  • Consider updating the detection logic to surface a helpful message when a 400 error contains "Unexpected value(s)" for the anthropic-beta header and ANTHROPIC_BASE_URL is custom.
  • Ensure that CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 suppresses all experimental headers, including newer ones like advisor-tool-2026-03-01, to prevent similar issues in the future.

Example

To set the environment variable, run the following command before executing claude:

export CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1

Notes

The provided workaround is specific to version 2.1.100, and it may not apply to other versions of Claude Code. The ideal fix would involve updating the detection logic to provide a clear, actionable message to the user.

Recommendation

Apply the workaround by setting CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1, as it provides an immediate solution to the issue and allows for continued use of the custom ANTHROPIC_BASE_URL.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING