[BUG] Stream idle timeout - partial response received (repeated on long Write/Edit tool calls)

Resolved 💬 3 comments Opened Apr 18, 2026 by ahmet6141 Closed May 26, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

I repeatedly receive the error:

API Error: Stream idle timeout - partial response received

This happens consistently during long tool calls — specifically Write or Edit operations that produce large content blocks (e.g. writing a full MDX/Markdown file, ~300–500 lines). The stream silently stalls mid-response, then the client aborts with "partial response received". No content is written to disk, so the work is lost and has to be retried.

It does NOT appear to be a network issue on my end — short tool calls and text generation work fine in the same session. The error only triggers on long-running single tool calls.

This is blocking on a paid Max plan. I've paid $200 and cannot complete normal workflows because every large file write has to be manually split into smaller chunks, and even then the timeout fires inconsistently.

What Should Happen?

The stream should not idle-timeout while the model is actively producing tokens. Either:

  1. The server should keep the connection alive (heartbeat/keep-alive frames) during long tool-call argument generation, OR
  2. The client should raise the idle-timeout threshold for active streams, OR
  3. The partial content should be recoverable (auto-resume/retry) instead of being discarded.

Large Write/Edit tool calls (a few hundred lines) should complete successfully in a single turn without manual chunking.

Error Messages/Logs

API Error: Stream idle timeout - partial response received

Steps to Reproduce

  1. Start a Claude Code session with model claude-opus-4-7.
  2. Ask Claude to write a large single file, e.g.:

"Write a 500-line MDX chapter at src/content/chapters/example.mdx with sections A, B, C, D, E, F, G, H and code blocks, math, quiz components."

  1. Claude begins the Write tool call.
  2. Partway through the tool input stream, the connection idles.
  3. Client aborts with: API Error: Stream idle timeout - partial response received.
  4. No file is written. Retrying often hits the same error on the same call.

Frequency: Happens on roughly 40–60% of tool calls whose output exceeds ~300 lines. Rarely happens on short calls.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

Claude Code

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

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