[BUG] /compact fails with ECONNRESET at only 35% context data — no recovery path when API is intermittently unstable
Preflight Checklist
- [x] I have searched [existing issues] and there are multiple such bugs reported but most of them were above 70% but for me it is failing at even 10% today
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code
What's Wrong?
/compact consistently fails with Error: Error during compaction: API Error: Unable to connect to API (ECONNRESET). Because compaction is the only way to free context space and continue a session, an ECONNRESET during /compact leaves the session in a permanently unrecoverable state — you can't continue without compacting, and compacting keeps failing. I have only hit 35% (350k out of 1M) of the context but due to another issue where the session crashes around 40% (already reported this bug as well), I am simply trying to compact and proceed in the same session as moving to a new session is not an option (Also consumes majority of the tokens which the current session has already consumed)
I am seeing the same issue today, around 3 to 4 times, that too when trying to compact a session which has only 20% context.
What Should Happen?
Claude should be able to compact the session, especially if it hasn't hit the context threshold (since the session is only at 35%)
Error Messages/Logs
Error during compaction: API Error: Unable to connect to API (ECONNRESET)
Steps to Reproduce
- Have an active session at ~35–40% context (it is failing even at 10% after compact suceeded today)
- Run /compact
- Receive Error during compaction: API Error: Unable to connect to API (ECONNRESET)
- Retry 4+ times — same result
- Session is now stuck with no forward path
Claude Model
Opus 4.8
Is this a regression?
Yes, this worked in a previous version
Last Working Version
2.1.144
Claude Code Version
2.1.146
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
VS Code integrated terminal
Additional Information
<img width="539" height="443" alt="Image" src="https://github.com/user-attachments/assets/dbcfd84b-428d-452f-82ab-634302bd0171" />
<img width="761" height="395" alt="Image" src="https://github.com/user-attachments/assets/3422ff78-450d-4437-959a-65969dfe5985" />
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗