CLI crashes silently on intermittent network issues instead of recovering gracefully

Resolved 💬 3 comments Opened Feb 22, 2026 by boudou Closed Feb 26, 2026

Bug Description

Claude Code CLI process dies silently (no error message, no graceful shutdown) when experiencing intermittent network connectivity issues. The process simply closes without any SessionEnd event or user-visible error. This happened multiple times during a single afternoon session.

Environment

  • Claude Code version: 2.1.50
  • Platform: Windows 11 Enterprise (Build 26100)
  • Node.js: v24.13.1
  • Installation: npm global
  • RAM: 64 GB

Steps to Reproduce

  1. Start a long Claude Code CLI session with active tool use (subagents, file edits, etc.)
  2. Have intermittent network instability (e.g., VPN/proxy hiccups, brief connectivity drops)
  3. The CLI process terminates without warning

Observed Behavior

Across two sessions today (~7 hours total), Claude Code crashed silently multiple times. Debug logs show the following pattern leading up to each crash:

1. API timeouts and connection errors

[ERROR] AxiosError: timeout of 5000ms exceeded
[ERROR] API error (attempt 1/11): undefined Request timed out.
[ERROR] API error (attempt 1/11): undefined Request was aborted.
[ERROR] API error (attempt 1/11): undefined Connection error.

2. Telemetry export failures (ECONNABORTED)

[ERROR] 1P event logging: 69 events failed to export (code=ECONNABORTED, timeout of 10000ms exceeded)
[ERROR] Failed to export 69 events (code=ECONNABORTED, timeout of 10000ms exceeded)

These occurred repeatedly throughout the session (batches of 1, 10, 24, 25, 26, 30, 37, 69 events failing).

3. Streaming corruption before crash

[ERROR] Error streaming, falling back to non-streaming mode: Content block input is not a string

This error appeared 16 consecutive times in a ~2 minute window (18:33-18:34), suggesting a corrupted/partial API response due to network instability.

4. No SessionEnd event

Both sessions (5b8a371c and 3f14f977) end abruptly in the debug logs — no SessionEnd hook fires, no cleanup, the log just stops writing. The process appears to have been killed or crashed without any graceful shutdown.

5. Subagent temp file cleanup failures

[ERROR] ENOENT: no such file or directory, unlink '...\tasks\*.output'

Multiple subagent output files were missing when cleanup was attempted — likely a symptom of the abrupt termination.

Expected Behavior

  • Claude Code should recover gracefully from transient network errors (retry with backoff, reconnect)
  • If recovery is not possible, it should display a clear error message to the user (e.g., "Lost connection to API, retrying..." or "Connection lost. Press Enter to retry.")
  • The process should not silently die — at minimum it should perform cleanup and fire SessionEnd
  • Telemetry export failures should not contribute to process instability

Additional Context

  • The API retry mechanism (attempt 1/11) appears to be present but the process crashes before exhausting retries
  • The session was doing heavy work (multiple sprints of dev-story workflow with subagents), so context was large (~109k tokens near threshold of 167k)

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗