claude-code - 💡(How to fix) Fix [BUG] v2.1.121: CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 + Opus 4.7 causes 401 "OAuth authentication is currently not supported" retry-loop [4 comments, 5 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#54235Fetched 2026-04-29 06:32:42
View on GitHub
Comments
4
Participants
5
Timeline
15
Reactions
6
Timeline (top)
labeled ×6commented ×4subscribed ×2closed ×1

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.

Error Message

API Error (attempt N/11): 401 {"type":"error","error":{"type":"authentication_error","message":"OAuth authentication is currently not supported."}} 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. 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."}} 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. 2. The server should return a clearer error when beta fields arrive without the header, or 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.

Root Cause

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.

Fix Action

Workaround

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

Code Example

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

---

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

---

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

---

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

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

VersionFlag setResult
v2.1.120CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1✅ works
v2.1.121CLAUDE_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.

extent analysis

TL;DR

The most likely fix is to unset the CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS environment variable or downgrade to version v2.1.120 to resolve the 401 retry-loop issue.

Guidance

  • The issue is likely caused by a beta-header/field mismatch when using CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 with Opus 4.7's default configuration.
  • To verify, try unsetting the CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS variable or downgrading to v2.1.120 and check if the issue persists.
  • If the issue is resolved, it confirms that the problem is related to the beta-header/field mismatch.
  • To mitigate the issue, users can unset the CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS variable or downgrade to v2.1.120 until a fix is available.

Example

unset CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS

or

ln -sfn ~/.local/share/claude/versions/2.1.120 ~/.local/bin/claude

Notes

The issue seems to be specific to version v2.1.121 and Opus 4.7's default configuration. The workaround provided should resolve the issue, but it may not be a permanent fix.

Recommendation

Apply the workaround by unsetting the CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS variable or downgrading to v2.1.120, as this is the most straightforward way to resolve the issue until a fix is available.

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