[Bug] Context limit reached: Cannot compact, operation fails

Status Fixed / completed
Maintainer reply ✓ Yes — chrislloyd
Activity 13 comments · opened Dec 16, 2025 · closed Dec 17, 2025
💡 Likely answer: A maintainer (chrislloyd, collaborator) responded on this thread — see the highlighted reply below.

Bug Description
i've seen this over and over again...conext low, can't compact. errors out

Environment Info

  • Platform: linux
  • Terminal: vscode
  • Version: 2.0.70
  • Feedback ID: eef20ec1-3888-42ee-8d14-4987883ff48a

Errors

[{"error":"MaxFileReadTokenExceededError: File content (34929 tokens) exceeds maximum allowed tokens (25000). Please use offset and limit parameters to read specific portions of the file, or use the GrepTool to search for specific content.\n    at ZEB (file:///usr/local/share/nvm/versions/node/v20.19.5/lib/node_modules/@anthropic-ai/claude-code/cli.js:957:11951)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async Object.call (file:///usr/local/share/nvm/versions/node/v20.19.5/lib/node_modules/@anthropic-ai/claude-code/cli.js:966:996)\n    at async file:///usr/local/share/nvm/versions/node/v20.19.5/lib/node_modules/@anthropic-ai/claude-code/cli.js:3437:1459","timestamp":"2025-12-16T16:22:33.594Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"tools: Tool names must be unique.\"},\"request_id\":\"req_011CWAg732B9iFUA4bwqQgqS\"}\n    at B9.generate (file:///usr/local/share/nvm/versions/node/v20.19.5/lib/node_modules/@anthropic-ai/claude-code/cli.js:459:10797)\n    at q_.makeStatusError (file:///usr/local/share/nvm/versions/node/v20.19.5/lib/node_modules/@anthropic-ai/claude-code/cli.js:796:2195)\n    at q_.makeRequest (file:///usr/local/share/nvm/versions/node/v20.19.5/lib/node_modules/@anthropic-ai/claude-code/cli.js:796:5419)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async w11.model (file:///usr/local/share/nvm/versions/node/v20.19.5/lib/node_modules/@anthropic-ai/claude-code/cli.js:4493:6319)\n    at async w11 (file:///usr/local/share/nvm/versions/node/v20.19.5/lib/node_modules/@anthropic-ai/claude-code/cli.js:1232:18701)\n    at async $d2 (file:///usr/local/share/nvm/versions/node/v20.19.5/lib/node_modules/@anthropic-ai/claude-code/cli.js:4493:6473)\n    at async file:///usr/local/share/nvm/versions/node/v20.19.5/lib/node_modules/@anthropic-ai/claude-code/cli.js:4491:3797\n    at async Jp1 (file:///usr/local/share/nvm/versions/node/v20.19.5/lib/node_modules/@anthropic-ai/claude-code/cli.js:946:2037)\n    at async uJA (file:///usr/local/share/nvm/versions/node/v20.19.5/lib/node_modules/@anthropic-ai/claude-code/cli.js:4491:3767)","timestamp":"2025-12-16T16:23:25.557Z"},{"error":"Error: API Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"tools: Tool names must be unique.\"},\"request_id\":\"req_011CWAg732B9iFUA4bwqQgqS\"}\n    at sB1 (file:///usr/local/share/nvm/versions/node/v20.19.5/lib/node_modules/@anthropic-ai/claude-code/cli.js:1651:1556)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async ieB (file:///usr/local/share/nvm/versions/node/v20.19.5/lib/node_modules/@anthropic-ai/claude-code/cli.js:1725:3259)\n    at async J$ (file:///usr/local/share/nvm/versions/node/v20.19.5/lib/node_modules/@anthropic-ai/claude-code/cli.js:1861:2369)\n    at async J$ (file:///usr/local/share/nvm/versions/node/v20.19.5/lib/node_modules/@anthropic-ai/claude-code/cli.js:1861:7648)\n    at async J$ (file:///usr/local/share/nvm/versions/node/v20.19.5/lib/node_modules/@anthropic-ai/claude-code/cli.js:1861:7648)\n    at async J$ (file:///usr/local/share/nvm/versions/node/v20.19.5/lib/node_modules/@anthropic-ai/claude-code/cli.js:1861:7648)\n    at async J$ (file:///usr/local/share/nvm/versions/node/v20.19.5/lib/node_modules/@anthropic-ai/claude-code/cli.js:1861:7648)\n    at async J$ (file:///usr/local/share/nvm/versions/node/v20.19.5/lib/node_modules/@anthropic-ai/claude-code/cli.js:1861:7648)\n    at async J$ (file:///usr/local/share/nvm/versions/node/v20.19.5/lib/node_modules/@anthropic-ai/claude-code/cli.js:1861:7648)","timestamp":"2025-12-16T16:23:25.559Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"tools: Tool names must be unique.\"},\"request_id\":\"req_011CWAg7SX3bqUGxQWzUf41W\"}\n    at B9.generate (file:///usr/local/share/nvm/versions/node/v20.19.5/lib/node_modules/@anthropic-ai/claude-code/cli.js:459:10797)\n    at q_.makeStatusError (file:///usr/local/share/nvm/versions/node/v20.19.5/lib/node_modules/@anthropic-ai/claude-code/cli.js:796:2195)\n    at q_.makeRequest (file:///usr/local/share/nvm/versions/node/v20.19.5/lib/node_modules/@anthropic-ai/claude-code/cli.js:796:5419)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async w11.model (file:///usr/local/share/nvm/versions/node/v20.19.5/lib/node_modules/@anthropic-ai/claude-code/cli.js:4493:6319)\n    at async w11 (file:///usr/local/share/nvm/versions/node/v20.19.5/lib/node_modules/@anthropic-ai/claude-code/cli.js:1232:18701)\n    at async %2

Note: Error logs were truncated.

View original on GitHub ↗

13 Comments

daniel-edgedelta · 8 months ago

observing the exact same issue

mathiaswillburger · 8 months ago

Same here. Error happens since version 2.0.70, before no error occurred.
/compact is not possible

<img width="1228" height="213" alt="Image" src="https://github.com/user-attachments/assets/d71eceb5-4c01-4c4c-8983-a98065d39771" />

github-actions[bot] · 8 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/14139
  2. https://github.com/anthropics/claude-code/issues/8408
  3. https://github.com/anthropics/claude-code/issues/8249

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

mathiaswillburger · 8 months ago

Definitely not related to the other issues, at least not directly.
The issue resolves itself when reverting back to 2.0.69 and resuming a conversation.

7fromheaven · 8 months ago

Same issue

joeperuzzi · 8 months ago

I am seeing the same issue, auto compact shows a general error in the lower right of the screen "Error compacting conversation". The chat will continue until Context low · Run /compact to compact & continue

and at any time running: > /compact
⎿ Error: Error during compaction: Error: API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"tools: Tool names must be unique."},"request_id":"req_011CWAp657arna3ZhYv8M8gz"}

OSX 15.5 M3-CHIP

tk-korman · 8 months ago

Same issue as @mathiaswillburger, previous workaround from here not working

Version: 2.0.70

MarjovanLier · 8 months ago

Seeing the same issue version 2.0.70

mahdimanesh · 8 months ago

Same here, on V2.0.70.:
⎿ Error: Error during compaction: Error: API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"tools: Tool names must be unique."},"request_id":"req_011CWAzVi9r6FGrsgbbAciVa"}

Using CC from within zsh terminal in Cursor V2.2.20 (should not matter though, imho) .
MacOS 15.7.2 M3 Max

CC tells me:

This is a bug in Claude Code's compaction feature - it's sending duplicate tool names to the Anthropic API.
The good news: We have 67,962 tokens remaining (out of 200,000), so we don't need to compact right now.

mahdimanesh · 8 months ago

UPDATE: This morning on V2.0.71 I could exit the session, resume and compact fine.

chrislloyd collaborator · 8 months ago

Thanks for the report, should be fixed in 2.0.71.

bhosmer-ant · 8 months ago
UPDATE: This morning on V2.0.71 I could exit the session, resume and compact fine.

@mahdimanesh thank you for the confirmation!

github-actions[bot] · 8 months 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.