Intermittent connection failures in Claude Code on WSL2

Resolved 💬 6 comments Opened Dec 19, 2025 by daniellomartra Closed Feb 15, 2026

Started: 2025-12-17 (evening)
Trigger: Unknown - no Claude Code, Windows, or WSL updates identified around this time

Behavior

  • Intermittent and unpredictable - some sessions work, others fail randomly
  • Sessions that were working can suddenly start failing, and vice versa
  • Happens on recently compacted conversations (not a context size issue)
  • Rewinding and resubmitting sometimes works, sometimes doesn't
  • Retries up to 10 times before exiting

Error Messages

  • API Error: Connection error.
  • Request timed out. Check your internet connection and proxy settings
  • Error during compaction: Error: API Error: Connection error.

Debug Logs

TLSSocket failures with AggregateError at TLSSocket.socketErrorListener appear in debug logs but were not captured in the error export. The logged errors show:

Error streaming, falling back to non-streaming mode: Connection error.

(Note: Telemetry export failures in the error block are downstream noise from the connection failures, not the root cause.)

What Still Works

Direct connectivity to Anthropic infrastructure is fine:

$ curl -s -o /dev/null -w "%{http_code} (%{time_total}s)" https://api.anthropic.com
404 (0.202s)# Expected - no endpoint at root, but TLS handshake succeeds

$ curl -s -o /dev/null -w "%{http_code}" https://statsig.anthropic.com
403# Reachable

$ curl -s -o /dev/null -w "%{http_code}" https://sentry.io
302# Reachable

  • DNS resolves in ~85ms
  • TLS handshakes complete successfully
  • Issue appears to be in Claude Code's connection handling, not network layer

Troubleshooting Attempted

  • Tested on home wifi and mobile hotspot - same issue on both
  • Full machine reboot
  • WSL shutdown and restart (wsl --shutdown)
  • Lowered MTU to 1400
  • Fresh sessions in /tmp - work briefly but issue persists
  • Ran /doctor - shows warning about local installation path

Environment

| Component| Version|
|--------------|----------------------------------|
| Claude Code| 2.0.72 (npm-local) |
| Node.js| v20.19.2 |
| Platform | WSL2 Ubuntu on Windows |
| WSL Kernel | 6.6.87.2-microsoft-standard-WSL2 |
| Windows | 11 (Build 26200) |
| Terminal | Windows Terminal |
| Subscription | Claude Max |
| Model| Opus 4.5 |

/doctor Output

Diagnostics
└ Currently running: npm-local (2.0.72)
└ Path: /usr/bin/node
└ Invoked: ~/.claude/local/node_modules/.bin/claude
└ Config install method: local
└ Auto-updates: enabled
└ Search: OK (vendor)
Warning: Local installation not accessible
Fix: Create alias: alias claude="~/.claude/local/claude"

View original on GitHub ↗

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