API stream hangs mid-response on complex generation tasks (all models: Opus, Sonnet, Haiku)

Resolved 💬 8 comments Opened Jan 21, 2026 by josh-argyle Closed Mar 2, 2026

Description

Claude Code sessions using Opus 4.5 repeatedly hang mid-stream when attempting complex generation tasks (e.g., writing comprehensive review documents). The API connection remains established but no tokens are received after the initial few.

Environment

  • Claude Code version: 2.1.14
  • Model: claude-opus-4-5-20251101
  • OS: Linux (Debian)
  • Extended thinking: enabled (high)

Reproduction Steps

  1. Start a session with Opus 4.5 and extended thinking enabled
  2. Build up context (~60-80K tokens) through normal work
  3. Ask the agent to write a comprehensive document (e.g., "write the comprehensive cross-phase consistency review")
  4. Agent responds with thinking like "Let me write the comprehensive review document now"
  5. Stream starts, receives 1-3 output tokens, then hangs indefinitely

Observed Behavior

From session 9b3cc295-c95a-4ca5-b79c-c969ff31b696:

{
  "content": [{"type":"text","text":"Now I have all the information I need. Let me write the comprehensive cross-phase consistency review."}],
  "stop_reason": null,
  "output_tokens": 1
}
  • TCP connections remain ESTABLISHED to Anthropic servers
  • Debug logs show "Stream started - received first chunk" then nothing
  • Process stays in Running state but produces no output
  • No error messages or retry attempts
  • Happens repeatedly (261 user interruptions logged due to this pattern)

Debug Log Pattern

[DEBUG] Stream started - received first chunk
[DEBUG] Stream started - received first chunk

Then silence. No further log entries despite process remaining active.

Attempted Fixes

  • Set MAX_THINKING_TOKENS=63999 (no effect - this is not a token limit issue since stream DOES start)
  • The request initiates and streams partial text before hanging

Impact

  • Occurring daily for 3+ days
  • Affects almost every session involving complex generation tasks
  • Forces users to interrupt and retry repeatedly
  • Makes Opus 4.5 unusable for document generation tasks

Request

Please investigate why the API stream stalls mid-response when using Opus 4.5 with extended thinking on larger contexts.

View original on GitHub ↗

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