[BUG] Context silently wiped after "Connection error" during streaming fallback

Status Fixed / completed
Maintainer reply None cached
Activity 3 comments · opened Jan 12, 2026 · closed Jan 12, 2026

No description provided.

View original on GitHub ↗

3 Comments

github-actions[bot] · 9 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/17072
  2. https://github.com/anthropics/claude-code/issues/17549
  3. https://github.com/anthropics/claude-code/issues/17711

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

KindEmily · 9 months ago

● I'm experiencing what appears to be the same underlying issue but with a different symptom.

The issue: PostToolUse hooks display "(1/2 done)" despite both hooks completing successfully #16273

My environment: Claude Code 2.1.5, WSL2, Opus
Same error chain:
Error streaming, falling back to non-streaming mode: Connection error.
Error in non-streaming fallback: Request was aborted.

Different outcome: Instead of crashing, my context is silently wiped - goes from ~86k tokens to ~2k. Session continues but all conversation history is lost. Debug logs show
suspicious Summarizing all X messages (~0 tokens) entries suggesting context is already empty when this triggers.

Before:
❯ /context
⎿ Context Usage
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ claude-opus-4-5-20251101 · 86k/200k tokens (43%)

After (following connection error + Esc):
❯ /context
⎿ Context Usage
⛁ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ claude-opus-4-5-20251101 · 2k/200k tokens (1%)

Debug log sequence:
2026-01-11T17:18:59.766Z [DEBUG] Summarizing all 5 messages (~0 tokens)
2026-01-11T17:19:00.439Z [ERROR] Error streaming, falling back to non-streaming mode: Connection error.
2026-01-11T17:19:02.262Z [DEBUG] Summarizing all 6 messages (~0 tokens)
2026-01-11T17:19:28.064Z [ERROR] Error streaming, falling back to non-streaming mode: Connection error.
2026-01-11T17:19:42.879Z [DEBUG] Streaming aborted by user: Request was aborted.
2026-01-11T17:19:42.879Z [ERROR] Error in non-streaming fallback: Request was aborted.

This may be a different code path hitting the same fallback failure, or the same bug with slightly different recovery behavior between versions. The silent context wipe is arguably more
dangerous than a crash since you don't realize it happened until you check /context.

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.