[BUG] Incorrect token limit exceeded error despite low usage
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?
We are experiencing an issue where Claude returns a "token limit exceeded" (or equivalent) error, even though the actual usage metrics indicate that we are well below the allowed limits.
Observed behavior:
- Claude stops processing requests and reports that all tokens have been consumed.
- However, the usage dashboard shows significantly lower consumption than the reported limit.
Evidence:
From the usage metrics:
- Total Requests: 577
- Total Successful Requests: 569
- Total Tokens: ~38,755,230
- Total Spend: ~$31.90
These numbers do not align with hitting any expected token limit.
Expected behavior:
The system should only return a token limit exceeded error when the actual usage reaches the configured quota.
Impact:
- Blocks normal usage of Claude
- Causes confusion due to mismatch between reported limits and actual metrics
- Potential disruption in production workflows
Additional context:
This appears to be either:
- A miscalculation of token usage
- A caching/state issue on the quota system
- Or an incorrect limit being applied to the account
Request:
Please investigate the discrepancy between reported token exhaustion and actual usage metrics, and clarify which limits are being enforced.
Attachments:
(Screenshot showing usage metrics vs error)
What Should Happen?
Claude should continue processing requests normally as long as the actual token usage remains below the configured quota limits.
The system should:
- Accurately track token consumption
- Only return a "token limit exceeded" error when the real usage reaches the defined limit
- Keep the API behavior consistent with the usage metrics shown in the dashboard
There should be no discrepancy between reported usage and enforced limits.
Error Messages/Logs
Steps to Reproduce
Steps to Reproduce:
- Send multiple requests to Claude via API (normal usage, no unusual payload sizes).
- Continue sending requests until the system starts returning a "token limit exceeded" (or similar) error.
- Open the Anthropic usage dashboard.
- Compare the reported token usage and spend with the expected limits.
- Observe that the error appears even though the usage metrics are significantly below any reasonable quota.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.87 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Warp
Additional Information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗