API Streaming Stalls Causing 59-138 Second Delays and Timeouts
API Streaming Stalls Causing 59-138 Second Delays and Timeouts
Environment
- Claude Code Version: Latest (npm-local installation)
- Model: claude-sonnet-4-5-20250929 (also reproduced with claude-opus-4-5-20251101)
- OS: macOS (Darwin 25.2.0)
- Date: January 13, 2026
Description
Claude Code is experiencing persistent streaming stalls where the API stops sending response chunks mid-generation, causing delays of 59-138 seconds before eventually timing out. This happens consistently throughout the day on normal requests with moderate context sizes.
Symptoms
- API request initiates successfully and receives first chunk within 2-3 seconds
- Stream then stalls completely - no chunks received for 59-138 seconds
- Claude Code's 5-minute timeout eventually triggers
- Falls back to non-streaming mode, which also fails
- Tokens displayed in UI stop incrementing during the stall
- Ctrl+C and resume temporarily works but issue recurs
Reproduction Pattern
Stall Timeline (from debug logs):
Stall #1 - 63.4 second gap:
2026-01-13T13:43:29.332Z [DEBUG] Stream started - received first chunk
2026-01-13T13:44:36.209Z [WARN] Streaming stall detected: 63.4s gap between events (stall #1)
2026-01-13T13:44:36.370Z [WARN] Streaming completed with 1 stall(s), total stall time: 63.4s
Stall #2 - 138.6 second gap:
2026-01-13T19:30:09.876Z [DEBUG] Stream started - received first chunk
2026-01-13T19:32:32.589Z [WARN] Streaming stall detected: 138.6s gap between events (stall #1)
2026-01-13T19:32:32.783Z [WARN] Streaming completed with 1 stall(s), total stall time: 138.6s
Stall #3 - 59.2 second gap:
2026-01-13T20:04:13.265Z [DEBUG] File written atomically (last tool execution completed)
2026-01-13T20:05:15.332Z [WARN] Streaming stall detected: 59.2s gap between events (stall #1)
2026-01-13T20:05:15.828Z [WARN] Streaming completed with 1 stall(s), total stall time: 59.2s
Timeout after 5 minutes:
2026-01-13T22:48:30.773Z [DEBUG] Stream started - received first chunk
2026-01-13T22:53:39.489Z [ERROR] Error streaming, falling back to non-streaming mode: Request timed out.
Frequency
Multiple times per hour, affecting majority of requests after ~10-15 minutes of session activity.
Context Details
- Context size: ~15-20k tokens (~58,620 characters per auto-tool-search logs)
- Stalls occur after: Normal tool execution (Bash, Read, Edit) completes successfully
- Pattern: Stream starts fine → receives first chunk → goes silent for 59-138s → timeout
- Network: Verified healthy (ping to api.anthropic.com: 13-30ms, 0% packet loss, total connection time <200ms)
What I've Ruled Out
- ✅ Local network issues (ping/curl tests show normal latency)
- ✅ Zombie processes (cleaned up all stale MCP servers)
- ✅ Resource constraints (system has ample CPU/RAM)
- ✅ Extended thinking configuration (disabled, issue persists)
- ✅ Context size (only ~15-20k tokens, well under limits)
- ✅ Local process issues (tools execute successfully before stall)
Error Logs
Streaming Stalls Throughout the Day:
2026-01-13T13:44:36.209Z [WARN] Streaming stall detected: 63.4s gap between events (stall #1)
2026-01-13T19:32:32.589Z [WARN] Streaming stall detected: 138.6s gap between events (stall #1)
2026-01-13T20:05:15.332Z [WARN] Streaming stall detected: 59.2s gap between events (stall #1)
Timeout Errors:
2026-01-13T13:50:37.421Z [ERROR] Error streaming, falling back to non-streaming mode: Request timed out.
2026-01-13T16:32:22.956Z [ERROR] Error streaming, falling back to non-streaming mode: Request timed out.
2026-01-13T22:53:39.489Z [ERROR] Error streaming, falling back to non-streaming mode: Request timed out.
Non-Streaming Fallback Also Fails:
2026-01-13T22:53:39.874Z [ERROR] Error in non-streaming fallback: 400 {"type":"error","error":{"type":"invalid_request_error","message":"thinking.enabled.budget_tokens: Input should be greater than or equal to 1024"},"request_id":"req_011CX6CWefspxQeyznoVaXmR"}
Multiple Request Aborts (from Ctrl+C workarounds):
2026-01-13T20:11:37.976Z [ERROR] Error in non-streaming fallback: Request was aborted.
2026-01-13T20:57:40.796Z [ERROR] Error in non-streaming fallback: Request was aborted.
2026-01-13T22:40:09.911Z [ERROR] Error in non-streaming fallback: Request was aborted.
2026-01-13T23:03:31.116Z [ERROR] Error in non-streaming fallback: Request was aborted.
Expected Behavior
API should stream response chunks continuously without 59+ second gaps.
Actual Behavior
API starts streaming, receives first chunk within 2-3 seconds, then goes completely silent for 59-138 seconds before timing out. Pattern suggests server-side processing delays or connection handling issues on Anthropic's end.
Workaround
Ctrl+C to interrupt the hanging request, then resume. This temporarily works but issue recurs within a few requests, requiring constant manual intervention.
Impact
Makes Claude Code essentially unusable for sustained work - every request requires manual intervention and retry, breaking flow and productivity. Issue has persisted for entire day across multiple sessions.
Additional Context
- Issue occurs across multiple terminal sessions
- Persists after restarting Claude Code
- Persists after killing zombie MCP server processes
- Persists after disabling extended thinking
- Persists on fresh conversation starts
- Affects multiple models: Reproduced with both Sonnet 4.5 and Opus 4.5
- Tools execute successfully - stall happens during API response generation
- Full debug logs available at:
~/.claude/debug/c884ff14-34d4-489b-b3cc-8fa6df30a4c8.txt
Attached Files
bug_report_errors.log- All WARN/ERROR messages from today's session (46 entries)bug_report_stall_context.log- Detailed context around each streaming stall
---
Request ID Examples:
req_011CX6CWefspxQeyznoVaXmR(timeout with thinking budget error)
Session ID: c884ff14-34d4-489b-b3cc-8fa6df30a4c8
This issue has 9 comments on GitHub. Read the full discussion on GitHub ↗