[BUG] v2.1.121: CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 + Opus 4.7 causes 401 "OAuth authentication is currently not supported" retry-loop
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.comsucceeds)
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
- The flag should also strip the beta-only body fields (it doesn't, on 2.1.121), or
- The server should return a clearer error when beta fields arrive without the header, or
- 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.
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗