[BUG] Stream idle timeout / partial response during long tool-use turns on Claude Code Web (Opus 4.7, 1M and non-1M)
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?
Environment
- Platform: Claude Code Web (claude.ai/code)
- Model(s) affected:
claude-opus-4-7[1m](1M context) — reproducibleclaude-opus-4-7(standard context) — also reproducible after switching- OS: Linux sandbox (provided by the web harness)
- Session type: long-running conversation with multiple tool calls
(Read / Bash / Grep), working in a git repo
- Approx. transcript length when error first appeared: mid-session,
after several dozen tool calls and a few long assistant messages
Summary
During turns where the assistant is about to produce a long text output
(e.g. drafting a ~400-line markdown design doc after a few Read/Bash
tool calls), the stream terminates with:
API Error: Stream idle timeout - partial response received
The error is not triggered by the tool calls themselves — tool results
arrive normally. It consistently fires in the window between the last
tool result and the start (or middle) of the long text reply.
Reproduction
- Open a Claude Code Web session with Opus 4.7 (1M) on a non-trivial
repo (mine: ~several hundred markdown/py files, custom CLAUDE.md).
- Hold a long design discussion (tens of turns, many Read/Grep/Bash
calls, several multi-paragraph replies).
- Ask the assistant to draft a long markdown document (~400+ lines)
into a file, preceded by 1–2 exploratory tool calls.
- Observe
Stream idle timeout - partial response receivedfire
after the tool calls complete but before / during the long write.
Retry attempts (even after slimming CLAUDE.md and switching fromclaude-opus-4-7[1m] to plain claude-opus-4-7) reproduce the same error.
Actual behavior
Stream aborts mid-turn with an idle timeout; partial response is
discarded from the user's perspective and the Write tool call never
executes. The session is usable afterwards, but the same turn cannot
be completed — it fails repeatedly at roughly the same point.
Impact
- Blocks any workflow that involves drafting a long file in a single
turn (design docs, protocol revisions, report packs).
- Forces the user to manually split work into smaller chunks, losing
the model's ability to produce a coherent document in one pass.
- Switching to the non-1M model does not resolve it, so it does not
appear to be strictly a 1M-context issue.
Workarounds tried (none fully effective)
- Slimmed CLAUDE.md to reduce per-turn context overhead — still fails.
- Switched
claude-opus-4-7[1m]→claude-opus-4-7— still fails. - Starting a fresh session helps temporarily, but the error returns
after the session grows.
Additional context
- The moments when errors occur most frequently are always during the combination of “multi‑turn conversations + about to generate long markdown.”
- The web version cannot call /help, and there is no way to report issues directly from the client, so I am submitting this issue manually.
- Session ID : https://claude.ai/code/session_014AtytC2zxPcAqaoj9LwcGi
Ask
- Is the idle timeout threshold tunable (e.g. via a server-side
setting or client flag)?
- Can the stream be kept alive with heartbeats during long
text generation so long Write tool calls don't get cut off?
- Is there a known interaction between 1M context and long
tail-end text streaming that we should avoid?
What Should Happen?
Expected behavior
The assistant should finish streaming the long reply, or at minimum
fail with a retriable error that preserves the in-progress Write/Edit
tool call.
Error Messages/Logs
API Error: Stream idle timeout - partial response received
Steps to Reproduce
- Open a Claude Code Web session with Opus 4.7 (1M) on a non-trivial
repo (mine: ~several hundred markdown/py files, custom CLAUDE.md).
- Hold a long design discussion (tens of turns, many Read/Grep/Bash
calls, several multi-paragraph replies).
- Ask the assistant to draft a long markdown document (~400+ lines)
into a file, preceded by 1–2 exploratory tool calls.
- Observe
Stream idle timeout - partial response receivedfire
after the tool calls complete but before / during the long write.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
Web (claude.ai/code), encountered on 2026-04-17
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Other
Additional Information
Additional observation (session 014AtytC2zxPcAqaoj9LwcGi, 2026-04-17):
Stream timeout fired during a ~210-line Edit call. The file write
itself completed successfully (verified via git status post-timeout);
only the client-side stream terminated. This suggests the issue is in
keep-alive / heartbeat between tool-result-accepted and next-assistant-
token, not in the tool execution itself.
12 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
I am getting the same !!!
Same here
Me too. Multiple times today
Why have all of the possible duplicated been closed as duplicates?
Where's the master bug record?
Same failure mode:
custom CLAUDE.md, context at roughly 33% of the window.
from scratch as a handoff for a new session.
then began the Write call.
response received` before the write completed in the UI.
over 2 consecutive days. All failed at roughly the same point.
Reducing the scope of the write did not help.
completed — consistent with this being a keep-alive / heartbeat
gap between tool-result-accepted and the next assistant token,
not a model or tool-execution issue.
Workarounds suggested by support (manual chunking of the write,
raising
CLAUDE_STREAM_IDLE_TIMEOUT_MS) do not apply to the Cloud/ browser surface. Confirmation that a fix is in progress for this
specific surface would be appreciated.
I encounter this frequently, and it makes cc on the web almost unusable for me, as my workflow frequently involves large yaml file edits.
In case it's not obvious from the OP, attempting to coax it along by saying "try again" or similar is a great way to burn tokens to no avail. When this does happen, I say:
"Commit and push what you have so far. Do not create more yaml. No more writes. I don’t care if it doesn’t validate. Commit and push NOW"
Then create a PR so I have the option of taking over in a terminal session. After that I might try asking it it break down its edits into smaller units, which is often successful.
Having the same issues - it's driving me crazy. Sadly no one is actively trying to fix it and we have to find complex workarounds
Chiming in, this happens to me pretty much every single time I use Claude.ai/code. Makes the product pretty much unusable.
I have noticed that is a 4.7 opus thing though, as sonnet 4.6 and haiku 4.5 have no such issues. Truly, opus 4.7 is the regression king.
+1 — Same issue on Windows native Claude Code (npm-global, v2.1.121, Node v22 LTS, web login auth).
Reproducible on a large monorepo:
Specific pattern observed:
Workarounds tested:
Question for maintainers:
Is CLAUDE_STREAM_IDLE_TIMEOUT_MS effective in practice for this scenario, or does the issue lie deeper in keep-alive between tool-result and next-token?
Happy to provide more session details if helpful.
Adding data to this issue — we're seeing the same pattern via the Anthropic MCP Connector (
mcp-client-2025-11-20beta, not Claude Code, but the same streaming-stall signature).Environment
mcp_serversparametermcp-client-2025-11-20Symptom
On approximately 4 out of 5 events in a controlled test harness, the streaming response stalls for ~300 seconds between
content_block_stop type=mcp_tool_useandcontent_block_start type=mcp_tool_result. The pattern is reproducible and consistently ~300s ± 15s — strongly suggesting a fixed-duration timeout-and-recover rather than genuine processing time.During the stall:
pingevents arrive at metronomic 30.000s ± 0.030s intervals for the entire gap (typically 10 pings)thinking_delta_count = 0(extended thinking is not enabled)message_start_count = 1(no silent reconnect)What's different about the stalled calls
The stall reproduces specifically on parallel tool-call batches. When the model emits two or more
mcp_tool_useblocks back-to-back (idx=4 and idx=5 in our trace, emitted 0.776s apart), the gateway holds all results and then flushes them in a single batch — bothmcp_tool_resultblocks (idx=6 and idx=7) arrive within 2ms of each other after the 300s stall.Single-tool calls in the same stream complete normally:
get_database_metadata): 9.0s round-trip ✓sql_exec): 301.9s round-trip ✗sql_execafter the gap): 4.6s ✓sql_exec): 4.8s ✓This matches the regression behavior reported in #14353, and the "proxy holds tool_results" pattern in #38437.
Three-source correlation isolates the stall upstream of the MCP server
We instrumented and cross-correlated three independent log sources for one stalled event (gap:
2026-05-20T17:26:41.464Z → 17:31:43.370Z, 301.9 seconds):| Source | Activity during the 301.9s gap |
|--------|--------------------------------|
| Harness stream-event log | 10 pings, no content blocks, no errors |
| Snowflake
ACCOUNT_USAGE.QUERY_HISTORY| 0.949s of actual query execution; idle for the remaining 298s || MCP server (
assistant_tool_invocations) | Tool calls logged with normalduration_msvalues [confirm fast durations before posting] |The MCP server returned its responses promptly. Snowflake idled for 298 of the 302 seconds. The Anthropic gateway then held the batched results for the remaining time before streaming them back. The latency is unambiguously upstream of the MCP server.
Related issues
This appears to be the same root behavior described in:
Reproduction
Anyone can repro with the MCP Connector beta:
mcp_serversto point to a remote MCP server that exposes 2+ fast toolscontent_block_start/content_block_stopevents with timestampscondition_b_snowflakeandcondition_c_semantic), the parallel batch stalls for ~300s before results arrive togetherHappy to file this as a fresh issue if the maintainers prefer to keep #18028 scoped to the Claude Code CLI case rather than the MCP Connector API case — but they look like the same underlying mechanism.
Workaround that worked for me:
Switching from Opus to Sonnet resolved the frequent hang/freeze issues I was experiencing.
Environment:
claude-opus-4-7(Max plan — auto-upgraded toclaude-opus-4-7[1m])claude-sonnet-4-6Note:
On Max/Team plans, selecting Opus automatically upgrades to the 1M context version, which cannot be avoided through the
/modelpicker alone. SettingCLAUDE_CODE_DISABLE_1M_CONTEXT=1in~/.claude/settings.jsondisables the auto-upgrade if you want to stay on Opus.Hope this helps others experiencing similar issues.