[BUG] v2.1.121: CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 + Opus 4.7 causes 401 "OAuth authentication is currently not supported" retry-loop

Status Fixed / completed
Reported on v2.1.121
Maintainer reply None cached
Activity 6 comments · opened Apr 28, 2026 · closed Apr 28, 2026

Summary

On Claude Code v2.1.121, setting CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 while using Opus 4.7 (1M context, default xhigh effort) with Claude Max OAuth auth causes every request to fail with:

API Error (attempt N/11): 401 {"type":"error","error":{"type":"authentication_error","message":"OAuth authentication is currently not supported."}}

The CLI shows only Retrying in Ns · attempt N/10 in the UI — the underlying 401 is hidden unless you launch with --debug-file.

The error message is misleading: OAuth itself is fine (raw curl to api.anthropic.com with the same OAuth token returns a normal response, and unsetting the flag makes the CLI work immediately). The real problem appears to be a beta-header / beta-field mismatch that surfaces as an OAuth error.

Environment

  • Claude Code: v2.1.121 (native install via ~/.local/share/claude/versions/2.1.121)
  • Model: Opus 4.7 (1M context, xhigh effort — current defaults)
  • Auth: Claude Max subscription (OAuth, ~/.claude/.credentials.json)
  • Platform: WSL2 Ubuntu 22.04 on Windows 11
  • Network: clean (verified TLS handshake + HTTP/2 to api.anthropic.com succeeds)

Reproduction

# Ensure no other ANTHROPIC_* / CLAUDE_* overrides are set
env | grep -iE 'anthropic|claude' | grep -v PATH

export CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1
claude
# Type any prompt, e.g. "hey"

Expected: Request succeeds. The flag is documented as the gateway fallback for environments that strip the anthropic-beta header.

Actual: 401 retry-loop, no usable error in the TUI. Debug log shows:

401 {"type":"error","error":{"type":"authentication_error","message":"OAuth authentication is currently not supported."}}

Bisection

| Version | Flag set | Result |
|---|---|---|
| v2.1.120 | CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 | ✅ works |
| v2.1.121 | CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 | ❌ 401 retry-loop |
| v2.1.121 | (flag unset) | ✅ works |

Single variable is the env flag on v2.1.121.

Confirmed via env-var bisection (binary-search through ~30 CLAUDE_* / ANTHROPIC_* / TCCW_* vars in our shell init): only CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 triggers it. All other empty/set vars are innocent.

Notably, the v2.1.121 release notes mention:

Fixed ANTHROPIC_BETAS environment variable being silently ignored when using Haiku models

— suggesting the beta-header resolution path was touched in this release, which is consistent with this regression.

Hypothesis

With Opus 4.7's default config (xhigh effort + 1M context + context_management), the CLI still sends beta-only fields in the request body when CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 strips the anthropic-beta header. The server then rejects the request, and the resulting error is reported as authentication_error: OAuth authentication is currently not supported rather than a clear invalid_request_error: missing beta header.

So: either

  1. The flag should also strip the beta-only body fields (it doesn't, on 2.1.121), or
  2. The server should return a clearer error when beta fields arrive without the header, or
  3. Opus 4.7's defaults shouldn't be incompatible with the documented disable-betas flag.

Workaround

unset CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS
# or downgrade
ln -sfn ~/.local/share/claude/versions/2.1.120 ~/.local/bin/claude

Impact

This flag is documented for users behind LLM gateways / proxies that strip the anthropic-beta header (e.g. AWS Bedrock proxies, custom routing). Anyone with that flag set in their shell init who upgrades to v2.1.121 + Opus 4.7 default config will hit a silent 401 retry-loop with no actionable error in the UI.

View original on GitHub ↗

6 Comments

Palkers76 · 5 months ago

Confirm same on team plan :( is anyone testing it before release!!!!

aimer1124 · 5 months ago

+1 reproducible on macOS (darwin-arm64) too with same trigger:

  • v2.1.121
  • CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 in ~/.claude/settings.json env block
  • Opus 4.7 + Claude Max OAuth
  • Removing the env entry fixes it; downgrade to 2.1.112 also works.
kenperkins · 5 months ago

Doesn't matter what model. Found this last night, assumed it was an outage, debugged further this morning and narrowed it down as @nestorcolt did.

szwang · 5 months ago

So sorry for the issues here. This should be fixed with 2.1.123, please let us know if you're still seeing this!

nestorcolt · 5 months ago

<img width="1157" height="160" alt="Image" src="https://github.com/user-attachments/assets/40d78fe8-87db-480f-a215-14b50d218d62" /> happy about it

github-actions[bot] · 5 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.