[Bug] Unexpectedly High API Usage and Rate Limit Hits

Status Closed — not planned
Reported on v2.1.87
Maintainer reply None cached
Activity 11 comments · opened Mar 31, 2026 · closed May 24, 2026

Bug Description
The usage this week was absurdly high, I've hit limits much faster than before, I've read I'm not the only one and that it's caused by bugs

Environment Info

  • Platform: darwin
  • Terminal: tmux
  • Version: 2.1.87
  • Feedback ID: 42960fb3-fb3b-4b74-bc76-c8656ba90099

Errors

[{"error":"Error: NON-FATAL: Lock acquisition failed for /Users/cminds/.local/share/claude/versions/2.1.87 (expected in multi-process scenarios)\n    at _p_ (/$bunfs/root/src/entrypoints/cli.js:2851:2138)\n    at Vn6 (/$bunfs/root/src/entrypoints/cli.js:2851:1218)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-03-29T17:53:40.525Z"},{"error":"Error: Agent type 'brand-kit-gen' not found. Available agents: general-purpose, statusline-setup, Explore, Plan, claude-code-guide, code-simplifier:code-simplifier, huggingface-skills:AGENTS, feature-dev:code-reviewer, feature-dev:code-explorer, feature-dev:code-architect, plugin-dev:skill-reviewer, plugin-dev:agent-creator, plugin-dev:plugin-validator, py-docs, wp-testing, py-planning, wp-planning, wp-docs, py-testing, py-research, wp-research, datastar-expert, ux-reviewer, robin, alfred, openrouter-delegate, batman, gemini-analyzer\n    at call (/$bunfs/root/src/entrypoints/cli.js:3184:4869)\n    at ji1 (/$bunfs/root/src/entrypoints/cli.js:3922:7155)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-03-30T20:21:45.464Z"},{"error":"Error: 429 {\"type\":\"error\",\"error\":{\"type\":\"rate_limit_error\",\"message\":\"This request would exceed your account's rate limit. Please try again later.\"},\"request_id\":\"req_011CZappfYCdo7NdC7jY2Mva\"}\n    at generate (/$bunfs/root/src/entrypoints/cli.js:11:51105)\n    at makeRequest (/$bunfs/root/src/entrypoints/cli.js:50:5435)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-03-31T08:15:23.412Z"},{"error":"Error: ensureToolResultPairing: repaired missing tool_result blocks (255 -> 255 messages). Message structure: [0] user; [1] assistant(id=msg_011HVGzHxA6JPiSW2UJz5PTy, tool_uses=[]); [2] user; [3] assistant(id=msg_01YA7LvKmwUwRCVyEdY3W6P3, tool_uses=[toolu_01Xy2MQvEyjUDwKaW9pBPoZW]); [4] user(tool_results=[toolu_01Xy2MQvEyjUDwKaW9pBPoZW]); [5] assistant(id=msg_01EG2U3dorSDiBLG3Pv8mYUo, tool_uses=[toolu_01EFQLJiE7rybwbScv9ukQQr,toolu_01HcyuqiRML4GKfxESv63Dpm,toolu_01GWWaazDVcWQJNYx4NkqqDv]); [6] user(tool_results=[toolu_01EFQLJiE7rybwbScv9ukQQr,toolu_01HcyuqiRML4GKfxESv63Dpm,toolu_01GWWaazDVcWQJNYx4NkqqDv]); [7] assistant(id=msg_01UzyeqhBgjY7VxcgwuFK4eZ, tool_uses=[toolu_01Qu1ML2zeALpLd6M6w91yb1,toolu_014eKaovcvurLXArAAP4ojZb,toolu_01FjM6fcSb3xA3okEna1VANj]); [8] user(tool_results=[toolu_01Qu1ML2zeALpLd6M6w91yb1,toolu_014eKaovcvurLXArAAP4ojZb,toolu_01FjM6fcSb3xA3okEna1VANj]); [9] assistant(id=msg_01LWUXegLuSV9Rjy8uDx4Si7, tool_uses=[]); [10] user; [11] assistant(id=msg_017kwSBzcM1vNGsyg3DQR7ar, tool_uses=[toolu_01MZXt1eBvDbpx4FUmwTgkNK,toolu_01YMwFXh4PZYdFEgJRAZqu1J]); [12] user(tool_results=[toolu_01MZXt1eBvDbpx4FUmwTgkNK,toolu_01YMwFXh4PZYdFEgJRAZqu1J]); [13] assistant(id=msg_018D9vwRUuHWKWEbGN13TPjt, tool_uses=[toolu_01R72iCWpw3weyoMMtXRjqvq]); [14] user(tool_results=[toolu_01R72iCWpw3weyoMMtXRjqvq]); [15] assistant(id=msg_01K3tceqQ2Z6mjvYTCGVH2Yw, tool_uses=[toolu_01XqmYy6F3QGQvZDi8WpmUGT,toolu_01CUJRrmFeit1iHjtVKbKQu1,toolu_013VQ8J3Sdf4NpAKQswGNhto]); [16] user(tool_results=[toolu_01XqmYy6F3QGQvZDi8WpmUGT,toolu_01CUJRrmFeit1iHjtVKbKQu1,toolu_013VQ8J3Sdf4NpAKQswGNhto]); [17] assistant(id=msg_01MkgYyZiiXxAZnovRh8G1TS, tool_uses=[toolu_01KS161S9EYgLheU1Mx1wcSC,toolu_01EAXeLmE25owmLzxTqURFqR,toolu_01GTkP4QLzy4HYharMqCJwon]); [18] user(tool_results=[toolu_01KS161S9EYgLheU1Mx1wcSC,toolu_01EAXeLmE25owmLzxTqURFqR,toolu_01GTkP4QLzy4HYharMqCJwon]); [19] assistant(id=msg_01XiEZM2wz1QYHKrB2Mniv77, tool_uses=[toolu_015XnNi5h7C69SHZiaTuF8Ac,toolu_01Gyhb33h3ttkLQNGbnjU34w,toolu_01YDivJQKqrU71hFxuMtxQPA]); [20] user(tool_results=[toolu_015XnNi5h7C69SHZiaTuF8Ac,toolu_01Gyhb33h3ttkLQNGbnjU34w,toolu_01YDivJQKqrU71hFxuMtxQPA]); [21] assistant(id=msg_01VC2Chtmtorb5BcMEMUyXgj, tool_uses=[toolu_01L7XDyXhX41UYTEcx6jjStS]); [22] user(tool_results=[toolu_01L7XDyXhX41UYTEcx6jjStS]); [23] assistant(id=msg_01W9Ta2imiRf8JjEGAfL8Eam, tool_uses=[toolu_01PGxnMGqqq4Fge6chwXMev9,toolu_012LYSfuYP36vbpQhxExsrVr,toolu_01RnEnAzKA5U8pH1cbhGWeHL,toolu_01QWGp1Vn9pa9tYMZnyuPoK4,toolu_01LeWfr1Lv2ZPVGPexXei4je,toolu_01SMpiHZY4yJx5FvFni3fXwA,toolu_0195HztKrMWL3o61La5E78uz]); [24] user(tool_results=[toolu_01PGxnMGqqq4Fge6chwXMev9,toolu_012LYSfuYP36vbpQhxExsrVr,toolu_01RnEnAzKA5U8pH1cbhGWeHL,toolu_01QWGp1Vn9pa9tYMZnyuPoK4,toolu_01LeWfr1Lv2ZPVGPexXei4je,toolu_01SMpiHZY4yJx5FvFni3fXwA,toolu_0195HztKrMWL3o61La5E78uz]); [25] assistant(id=msg_01D6SmGoxxiL3me4VR97UQQY, tool_uses=[toolu_01MYfeKRp6yo2j94tkjLR9yF]); [26] user(tool_results=[toolu_01MYfeKRp6yo2j94tkjLR9yF]); [27] assistant(id=msg_01Pysz6Jy6hawiKTGMsqZ9jF, tool_uses=[toolu_01BrydDqQEPVzjvaWHTrtSA2]); [28] user(tool_results=[toolu_01BrydDqQEPVzjvaWHTrtSA2]); [29] assistant(id=msg_01PN241zPvRwx5P4v8Mnx31q, tool_uses=[toolu_01UDqJ4fyddyLLCm1NchodW5]); [30] user(tool_results=[toolu_01UDqJ4fyddyLLCm1NchodW5]); [31] assistant(id=msg_01N9NPodTEFYetrjVHDBjpmG, tool_uses=[toolu_01JUPBRwNEMPLngr98Q5F6Jm,toolu_01Dp4AKRR9Aaa4tPcZx83bGx]); [32] user(tool_results=[toolu_01JUPBRwNEMPLngr98Q5F6Jm,toolu_01Dp4AKRR9Aaa4tPcZx83bGx]); [33] assistant(id=msg_019W8dtVU8trC75j834g1zzV, tool_uses=[toolu_01PjfYWoHYgtNYjSJuHS2pY7]); [34] user…

Note: Content was truncated.

View original on GitHub ↗

11 Comments

github-actions[bot] · 5 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/41506
  2. https://github.com/anthropics/claude-code/issues/41504
  3. https://github.com/anthropics/claude-code/issues/40949

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

ArkNill · 5 months ago

Same. Max 20 ($200/mo), v2.1.89. April 1: 100% in ~70 min after reset. Light usage only.

Full report: #41788
Related: #38335, #38239, #41663, #41506

ArkNill · 5 months ago

I've been experiencing the same issue on Max 20 ($200/mo) — rate limit 100% exhausted in ~70 minutes.

After setting up a monitoring proxy using the official ANTHROPIC_BASE_URL env var, I identified two cache bugs as the root cause (#40524, #34629) and measured the impact: cache read ratio dropped to 4.3%, meaning ~20x token inflation per turn. After applying workarounds it stabilized at 89-99%.

Full analysis with per-request measured data, safe workarounds, and community references (including cc-cache-fix): https://github.com/ArkNill/claude-code-cache-analysis

Tito-42 · 5 months ago

For me, 01/04/2026, this morning: rate limit 100% exhausted in ~50 minutes. I waited 4 hours and the rate limit was 100% exhausted again with a single prompt.

ArkNill · 5 months ago

Follow-up — precautions (April 2, 2026)

For anyone landing here, additional behaviors that compound the cache bugs:

Avoid: --resume (replays full history as billable input), /dream & /insights (background drain), v2.1.89 (cache bug + terminal regression)
Careful with: sub-agents/Haiku (0% cache read), multiple terminals, large CLAUDE.md
Recommended: v2.1.81 fixed, fresh sessions, proxy monitoring

Ref: https://github.com/ArkNill/claude-code-cache-analysis

ArkNill · 5 months ago

Update (April 2): v2.1.90 has significantly improved cache efficiency — benchmark shows 95-99% cache read in stable sessions (both npm and standalone installations).

If you're still affected:

  1. Update: claude update (or npm install -g @anthropic-ai/claude-code)
  2. Pin the version: add "DISABLE_AUTOUPDATER": "1" to ~/.claude/settings.json env section
  3. Avoid --resume (still broken)

Note: server-side quota issues (org-level pool sharing, accounting mismatches) remain unresolved — the above fixes the client-side cache drain only.

Benchmark data: https://github.com/ArkNill/claude-code-cache-analysis

ArkNill · 5 months ago

April 3 update: v2.1.91 fixes the cache regression that caused the worst drain. If you are still hitting limits after updating, there are additional unfixed mechanisms: a 200K tool result budget cap, a client-side false rate limiter, and silent context stripping — all confirmed via proxy testing. Anthropic acknowledged peak-hour tightening on X (Lydia Hallie) but stated "none were over-charging you." Measured data and analysis: claude-code-cache-analysis

marlvinvu · 4 months ago

My Claude says issue #41506 has the most comprehensive analysis from two users who measured the problem from both client-side and server-side, including a timeline of which versions are affected and specific workarounds.

junaidtitan · 4 months ago

Context bloat compounds silently — each turn re-sends accumulated tool outputs, progress entries, and metadata. Cozempic strips this automatically so you get more turns per rate limit window. Lossless — nothing meaningful is removed.

pip install cozempic && cozempic init

Feedback welcome.

github-actions[bot] · 3 months ago

Closing for now — inactive for too long. Please open a new issue if this is still relevant.

github-actions[bot] · 1 month ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.