Frequent streaming stalls and ECONNRESET during complex tasks
Resolved 💬 3 comments Opened Mar 17, 2026 by songwenshuai Closed Mar 20, 2026
Problem
During complex, long-running tasks, Claude Code frequently experiences streaming stalls and ECONNRESET errors, causing session interruptions and workflow disruption.
Environment
- Claude Code version: 2.1.70
- OS: WSL2 (Linux 5.15.167.4-microsoft-standard-WSL2) on Windows
- Model: claude-opus-4-6 (1M context)
Symptoms
1. Streaming Stalls (most frequent)
From debug logs (~/.claude/debug/), over 120+ streaming stall events observed across sessions from Feb 25 to Mar 9:
[WARN] Streaming stall detected: 367.5s gap between events (stall #1)
[WARN] Streaming stall detected: 282.2s gap between events (stall #1)
[WARN] Streaming stall detected: 272.0s gap between events (stall #1)
[WARN] Streaming stall detected: 252.8s gap between events (stall #1)
- Stall duration ranges from 30s to 367s (up to ~6 minutes)
- Some sessions have 30+ stalls in a single conversation (e.g., session
8037cf20on Mar 5) - Stalls are especially frequent during extended thinking with large context windows
2. API Connection Errors
[ERROR] API error (attempt 1/11): undefined Connection error.
[ERROR] API error (attempt 2/11): undefined Connection error.
3. ECONNRESET
Unable to connect to API (ECONNRESET)
This happens mid-conversation during complex tasks, forcing the user to resume or restart.
Impact
- Complex refactoring tasks that require large context are frequently interrupted
- Users cannot complete multi-step tasks without repeated disconnections
- No way to configure timeout or keep-alive behavior to mitigate the issue
Feature Request
- Configurable API timeout / keep-alive settings — Allow users to configure streaming timeout, connection timeout, and keep-alive intervals via
settings.jsonor environment variables (e.g.,CLAUDE_API_TIMEOUT,CLAUDE_STREAM_TIMEOUT) - Better stall recovery — When a streaming stall is detected, automatically attempt to reconnect and resume rather than hanging indefinitely
- Stall threshold configuration — Allow users to set the threshold for when a stall triggers a reconnection attempt
Reproduction
- Start a complex task with large context (e.g., multi-file refactoring with extended thinking)
- Observe streaming stalls in debug logs after ~30-60 seconds of inactivity
- Eventually encounter ECONNRESET or indefinite hang
Workarounds Attempted
claude --resumeafter disconnection- Reducing thinking depth (
/think low) - Splitting tasks into smaller conversations
- None of these fully resolve the issue for complex tasks that inherently require large context
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗