claude-code - 💡(How to fix) Fix [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 [1 comments, 2 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#54982Fetched 2026-05-01 05:49:21
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
1
Author
Timeline (top)
labeled ×4commented ×1

Error Message

  1. "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. Plan and usage state at the moment of the error
  • 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.
  • Each click on "Try again" after a "Prompt is too long" error increments plan usage by ~2%, despite producing no model response.
  1. Trigger "API Error: Prompt is too long" by exceeding 200k tokens.
  2. 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%. 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: no leaking credits and no API error, just working.

Error Messages/Logs

RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • 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

  • I have searched existing issues; this appears closely related to #52249 ("Prompt is too long" corrupting usage state on Max 5x)
  • This is a single bug report
  • 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:

  1. "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.
  2. 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.
  3. 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

  1. Use Claude Code on a Max (5x) plan with Sonnet 4.6 in a session that grows the context toward the 200k limit.
  2. Trigger "API Error: Prompt is too long" by exceeding 200k tokens.
  3. Click "Try again" a few times; observe plan usage increment by ~2% per failed attempt despite no successful response.
  4. Wait for the 5-hour window to reset.
  5. Observe that the new session immediately registers ~20% used rather than 0%.
  6. 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

  1. claude.ai → Settings → Usage panel showing 20% / 77% / 27% / 0% with "Last updated: less than a minute ago".
  2. 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.
  3. 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

  1. claude.ai → Settings → Usage panel showing 20% / 77% / 27% / 0% with "Last updated: less than a minute ago".
  2. 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

extent analysis

TL;DR

The issue can be mitigated by avoiding the "Prompt is too long" error, which may involve adjusting the context window size or waiting for a fix that prevents failed requests from consuming credits.

Guidance

  • Verify that the issue is indeed caused by the "Prompt is too long" error consuming credits by checking the usage dashboard and observing the credit consumption pattern.
  • Attempt to reproduce the issue with a smaller context window size to see if it prevents the error and subsequent credit consumption.
  • Consider reaching out to the development team to report the issue and request a fix that prevents failed requests from consuming credits.
  • In the meantime, users can try to avoid triggering the "Prompt is too long" error by being mindful of the context window size and adjusting it as needed.

Example

No code snippet is provided as the issue seems to be related to the usage tracking backend and the Claude Code client, rather than a specific code implementation.

Notes

The issue appears to be a regression, as it worked in a previous version. The exact cause of the issue is unclear, but it seems to be related to the state-sync between the usage tracking backend and the Claude Code client.

Recommendation

Apply workaround: Avoid triggering the "Prompt is too long" error by adjusting the context window size or waiting for a fix that prevents failed requests from consuming credits. This is recommended because it may help mitigate the issue until a permanent 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