1M-context session becomes unrecoverable: ECONNRESET on large uncached requests, and /compact fails with the same error
Open 💬 1 comment Opened Jul 5, 2026 by Rterrell25
Summary
Sessions with very large 1M-context conversations (~520k tokens) repeatedly fail with API Error: Unable to connect to API (ECONNRESET) when the prompt cache has gone cold, and — critically — /compact fails with the same error, because compaction itself requires sending the full context. This leaves the session unrecoverable: the user's only option is abandoning it and starting a new session, losing all conversational state.
Environment
- Claude Code v2.1.197, macOS (Darwin 25.2.0)
- Model:
claude-fable-5[1m](1M context beta) - No VPN, no proxy, no
ANTHROPIC_BASE_URLoverride - status.claude.com showed all systems operational during the failures
Symptoms
- Affected session context: ~520k tokens; last successful request showed
cache_creation_input_tokens: 496847(i.e., nearly the entire context re-ingested uncached after the ~5 min cache TTL lapsed). - Requests hang for many minutes ("Cogitated for 8m 7s") then die with
ECONNRESETor "socket connection was closed unexpectedly"; occasionaloverloaded_error(529) and 500s in the same windows. - Errors came in bursts across multiple days (2026-07-04 16:08–16:27, 20:50, 21:32–22:03 UTC; 2026-07-05 18:14+ UTC).
- Small sessions (~45k tokens, mostly cache hits) in the same environment at the same time worked flawlessly. Direct connectivity checks to
api.anthropic.comduring a failure window were clean (5/5 connects, ~27ms). - Attempting to recover with
/compactfailed:Error during compaction: API Error: Unable to connect to API (ECONNRESET).
Why this is a product bug and not just transient API weather
- Auto-retry re-pays the full ~500k-token uncached ingestion on every attempt, keeping the session in the failure-prone state for many minutes per retry cycle.
/compact— the documented remedy for oversized context — requires the exact same giant request that is failing. When a session most needs compaction, compaction is least likely to succeed.
Suggested improvements
- Make compaction resilient for huge contexts: chunked/incremental summarization, or compaction that can resume across failed attempts instead of resending the entire context each time.
- Surface a clearer error/hint when repeated ECONNRESETs correlate with very large uncached prompts (e.g., suggest compacting before the context grows past the point where compaction itself can fail).
- Consider keeping the prompt cache warm (or warning on cache expiry) for sessions above some context size, since a cold cache is what turns each request into a multi-minute vulnerable window.
Impact
User lost an active large working session and had to reconstruct state in a fresh session by hand. Retries did eventually succeed for normal messages, but each cycle cost many minutes, and the recovery path (/compact) was unusable.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗