[BUG] 400 error with custom ANTHROPIC_BASE_URL should suggest CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1

Resolved 💬 3 comments Opened Apr 10, 2026 by monperrus Closed Apr 13, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report
  • [x] 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:

``bash
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
``

  1. Run claude and send any prompt.
  2. 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.

View original on GitHub ↗

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