[BUG] Claude Code shows "Usage limit reached" while all plan limits are well below 100%; new 5-hour session jumped to ~20% immediately after reset
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?
Title: [BUG] "Prompt is too long" errors burn credits on retry, corrupt session state, and trigger false "Usage limit reached" on Max (5x)
Preflight checklist
- [x] I have searched existing issues; this appears closely related to #52249 ("Prompt is too long" corrupting usage state on Max 5x)
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code (v2.1.123)
What's wrong?
A chain of three connected symptoms, all on the same Max (5x) account, that together strongly suggest a state-sync / accounting bug between the Claude Code client and the usage tracking backend:
- "Prompt is too long" API errors that consume usage on every retry. Claude Code returns a red "API Error: Prompt is too long" banner with a "Try again" button. Each retry visibly increments my plan usage (~2% per attempt) even though no successful response is produced. The error itself is plausible — the in-client context indicator was at 111.4k / 200.0k (56%) just before, and presumably crossed the 200k limit — but credits should not be charged for requests that fail with a 400-class context-length error.
- The 5-hour session counter does not reset cleanly. After the previous 5-hour window expired, the new session immediately registered ~20% used rather than starting at 0%, with no corresponding workload in the new window. This points to usage state from the previous window (or from failed "Prompt is too long" attempts) bleeding into the next one.
- A red "Usage limit reached" banner appears while no plan limit is actually exhausted. Both the in-client usage popover and the claude.ai → Settings → Usage dashboard show the same numbers, none of them at or near 100%, yet input is disabled.
Plan and usage state at the moment of the error
- Plan: Max (5x)
- Active model: Sonnet 4.6 (Medium)
- 5-hour session limit: 20% used (resets in ~4h 34min) — jumped to this level immediately after the previous window reset
- Weekly limit, all models: 77% used (resets in ~19h 34min)
- Weekly limit, Sonnet only: 27% used (resets in ~19h 34min)
- Weekly limit, Claude Design: 0% used
- Context window before the failures: 111.4k / 200.0k (56%)
- Dashboard "Last updated: less than a minute ago"
Despite none of these limits being at or near 100%, the input field is disabled and Claude Code displays "Usage limit reached".
Expected behavior
- Failed requests with "Prompt is too long" / context-length errors should not count against plan usage. A 400-class client-side error should not consume credits.
- A freshly reset 5-hour session should start at 0% used, not ~20%.
- With the 5-hour limit at 20%, the weekly limits at 77% / 27% / 0%, and the context window at 56% (just before the failures), Claude Code should accept input as normal.
Actual behavior
- Each click on "Try again" after a "Prompt is too long" error increments plan usage by ~2%, despite producing no model response.
- The 5-hour counter jumped to ~20% immediately after the previous window reset.
- A red "Usage limit reached" banner is shown, even though no limit shown by either the client or the dashboard is exhausted.
Steps to reproduce
- Use Claude Code on a Max (5x) plan with Sonnet 4.6 in a session that grows the context toward the 200k limit.
- Trigger "API Error: Prompt is too long" by exceeding 200k tokens.
- Click "Try again" a few times; observe plan usage increment by ~2% per failed attempt despite no successful response.
- Wait for the 5-hour window to reset.
- Observe that the new session immediately registers ~20% used rather than 0%.
- Continue normal use; observe a "Usage limit reached" banner appearing while every limit shown in both the client and the dashboard remains below 100%.
Environment
- OS: macOS (Apple M1)
- Claude Code version: 2.1.123
- Plan: Claude Max (5x)
- Date/time of incident: 2026-04-30, ~13:25–13:39 (Europe/Amsterdam)
Screenshots attached
- claude.ai → Settings → Usage panel showing 20% / 77% / 27% / 0% with "Last updated: less than a minute ago".
- Claude Code interface showing the red "Usage limit reached" banner alongside the in-client usage popover, which shows the same non-exhausted percentages and a 56% context window.
- Two consecutive "API Error: Prompt is too long" banners in Claude Code, with a "Try again" button on the second — each retry increments plan usage by ~2%.
Additional notes / relation to existing issues
This pattern strongly resembles issue #52249, which traces a similar lockout to a "Prompt is too long" API error corrupting usage state on Max 5x. In my case the chain is visible end-to-end:
- context approaches the 200k limit
- "Prompt is too long" begins firing
- each "Try again" charges ~2% to plan usage despite returning no response
- the next 5-hour window starts at ~20% rather than 0%
- "Usage limit reached" is enforced while the dashboard still shows substantial headroom
This suggests the underlying issue is not a single false-lockout bug but a billing/accounting path where failed context-length requests are counted against plan usage and that count is then carried across session boundaries.
- OS: macOS (Apple M1)
- Claude Code version: 2.1.123
- Plan: Claude Max (5x)
- Date/time of incident: 2026-04-30, ~13:25 (Europe/Amsterdam)
Screenshots attached
- claude.ai → Settings → Usage panel showing 20% / 77% / 27% / 0% with "Last updated: less than a minute ago".
- Claude Code interface showing the red "Usage limit reached" banner alongside the in-client usage popover, which shows the same non-exhausted percentages and a 56% context window.
Additional notes
<img width="813" height="251" alt="Image" src="https://github.com/user-attachments/assets/5f818be3-d150-4e88-a510-b25ab72745d9" />
<img width="918" height="618" alt="Image" src="https://github.com/user-attachments/assets/68b28190-7062-4145-a5d5-55538b77fee8" />
<img width="827" height="301" alt="Image" src="https://github.com/user-attachments/assets/dba19af8-21b4-41f1-8cf2-110ce495031b" />
This looks like a state-sync issue between the usage tracking backend and the Claude Code client, with two visible symptoms: (a) the limit is enforced when the dashboard says it shouldn't be, and (b) usage from the previous 5-hour window appears to bleed into the next one rather than fully resetting.
What Should Happen?
no leaking credits and no API error, just working.
Error Messages/Logs
Steps to Reproduce
this is not the issue
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.123
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗