[BUG] Claude Code (non-interactive/headless, OAuth) requires usage credits enabled even when well within plan limits; usage credits toggle turns itself off spontaneously
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Platform: Windows, Claude Code non-interactive (headless) mode, OAuth authentication, Max plan
Bug 1 — Usage credits required when not over limit:
Claude Code running in non-interactive/headless mode via OAuth fails with:
"Usage credits are required for long context requests."
This error occurs even when weekly usage is at 0–3% and the session limit has not been reached. The only workaround is to enable usage credits in claude.ai/settings/usage. No credits are actually charged during these sessions, suggesting the error is a false positive — the system is gating headless Claude Code behind usage credits regardless of actual consumption.
Related issue: #61828
Bug 2 — Usage credits toggle turns itself off spontaneously:
After enabling usage credits to work around Bug 1, the toggle in claude.ai/settings/usage spontaneously flips to the Off position on its own during active sessions. When this happens, Claude Code stops working immediately.
When navigating to the toggle to re-enable it, a confirmation dialog appears asking "Are you sure you want to turn it Off?" — indicating the server-side state is still On. The UI is displaying the wrong state. Dismissing the dialog (keeping it On) restores the correct display, and Claude Code resumes working after a restart — no actual change was made.
Expected behavior:
- Headless Claude Code via OAuth should not require usage credits when plan limits have not been reached.
- The usage credits toggle UI should accurately reflect server-side state and should not flip spontaneously.
Steps to reproduce Bug 2:
- Enable usage credits
- Run Claude Code in non-interactive/headless mode via OAuth for an extended session
- Observe the toggle in claude.ai/settings/usage switches to Off on its own
- Claude Code stops working
- Navigate to toggle — confirmation dialog says "turn Off?" (server still On)
- Dismiss dialog — toggle shows On — Claude Code resumes after restart
What Should Happen?
Claude Code non-interactive (headless) mode should accept OAuth for Max plan within usage limits without requiring Usage credits enabled, and Usage credits toggle should remain on if user sets them as on.
Error Messages/Logs
Steps to Reproduce
For Bug 1:
Have a Max plan Claude.ai account authenticated via OAuth
Ensure weekly usage is well below plan limits (verify at claude.ai/settings/usage)
Run Claude Code in non-interactive/headless mode
Observe the error: "Usage credits are required for long context requests."
Enable usage credits at claude.ai/settings/usage
Re-run Claude Code — it works, but no credits are charged
For Bug 2:
Enable usage credits (workaround for Bug 1)
Run Claude Code in non-interactive/headless mode for an extended session
At some point during the session, navigate to claude.ai/settings/usage
Observe the usage credits toggle is showing Off despite not having been changed
Claude Code stops accepting requests at this point
Click the toggle to re-enable — a confirmation dialog appears saying "Are you sure you want to turn it Off?" confirming server-side state is still On
Dismiss the dialog without changing anything
Toggle now correctly shows On
Restart Claude Code — resumes working normally with no credits charged
Claude Model
Not sure / Multiple models
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.141 (Claude Code)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
_No response_
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗