[Bug] Context limit reached: Cannot compact, operation fails
Status Fixed / completed
Maintainer reply ✓ Yes — chrislloyd
Workaround ✓ Mentioned in thread ↓
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.
13 Comments
observing the exact same issue
Same here. Error happens since version 2.0.70, before no error occurred.
/compactis not possible<img width="1228" height="213" alt="Image" src="https://github.com/user-attachments/assets/d71eceb5-4c01-4c4c-8983-a98065d39771" />
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
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.
Same issue
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
Same issue as @mathiaswillburger, previous workaround from here not working
Version: 2.0.70
Seeing the same issue version
2.0.70Same 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.
UPDATE: This morning on V2.0.71 I could exit the session, resume and compact fine.
Thanks for the report, should be fixed in 2.0.71.
@mahdimanesh thank you for the confirmation!
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.