API Streaming Requests Hang for 3-30 Minutes Before Aborting

Resolved 💬 3 comments Opened Feb 2, 2026 by athiffau Closed Feb 5, 2026

Bug Report: API Streaming Requests Hang for 3-30 Minutes Before Aborting

Summary

Claude Code frequently hangs for 3-30 minutes after tool execution completes, before displaying assistant responses. Debug logs show the API streaming request hangs and eventually aborts with "Request was aborted" errors.

Environment

  • Claude Code Version: 2.1.17
  • OS: Linux (Ubuntu/Debian based)
  • Connection: Stable network (DNS: 60ms, API endpoint: 110ms)
  • ISP: Home network (tested, not ISP-related)

Detailed Description

After any tool execution (Bash, Read, Git, etc.), the tool result displays immediately but Claude's text response hangs for extended periods (3-30 minutes randomly) before appearing.

Key Findings from Debug Logs:

  1. Tool execution completes quickly - no issues with tool performance
  2. API streaming request hangs - no data flowing after request initiated
  3. Request eventually aborts - Claude Code times out and aborts after ~6 minutes
  4. Retry succeeds or continues hanging - sometimes multiple retries needed

Evidence from Debug Logs

Hang Example (6 minute gap):

2026-02-01T19:43:03.349Z [DEBUG] Execution timeout: 10000ms
[... 5 minutes 39 seconds of silence ...]
2026-02-01T19:48:42.974Z [ERROR] Error in non-streaming fallback: Request was aborted.
2026-02-01T19:48:42.974Z [ERROR] Error: Error: Request was aborted.

Concurrent Errors (may be related):

2026-02-01T02:17:37.579Z [ERROR] API error (attempt 1/11): 400 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_011CXgYd9LRPVYMKpf5hsnDA"}

Steps to Reproduce

This occurs randomly but consistently:

  1. Execute any tool command (git, bash, read, etc.)
  2. Tool completes and result displays immediately
  3. Wait for assistant response
  4. Hang occurs - no response for 3-30 minutes
  5. Eventually response appears, or user interrupts

Workaround: User interruption often triggers retry that succeeds immediately.

Impact

  • Severely impacts productivity - unable to predict when hangs will occur
  • Requires constant monitoring - user must watch for hangs and interrupt manually
  • No user-side fix available - network tests all pass, issue is API-side

Network Tests (All Pass)

$ time nslookup api.anthropic.com
real    0m0.060s

$ curl -w "\nTime: %{time_total}s\n" -o /dev/null -s https://api.anthropic.com/
Time: 0.109949s

Pattern Analysis

  • ✅ Tool execution: Fast (seconds)
  • ✅ Network connectivity: Fast (<110ms)
  • ✅ DNS resolution: Fast (60ms)
  • ❌ API streaming response: Hangs (3-30 minutes)
  • ✅ Retry after abort: Often succeeds immediately

Expected Behavior

API streaming responses should start within 1-2 seconds of tool completion, matching the fast network connectivity observed.

Additional Context

Debug logs located at: ~/.claude/debug/<session-id>.txt

The "thinking.enabled.budget_tokens" errors may be triggering a fallback streaming mode that causes these hangs. Errors appear intermittently but correlate with hang frequency.

Request

Please investigate:

  1. Why API streaming requests hang for minutes despite fast network
  2. Connection between thinking budget token errors and streaming hangs
  3. Timeout/retry logic - why 6+ minute wait before abort?
  4. Whether this is regional/infrastructure related

This issue makes Claude Code nearly unusable for sustained development work. Happy to provide full debug logs or additional testing if needed.

View original on GitHub ↗

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