claude-code - 💡(How to fix) Fix API stream timeout causes silent failure - no retry, no user notification [1 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#48501Fetched 2026-04-16 06:58:26
View on GitHub
Comments
1
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
closed ×1commented ×1

Error Message

API Error: Stream idle timeout - partial response received

This error appears in internal logs but is not surfaced to the user.

Fix Action

Fix / Workaround

  • Claude Code CLI
  • Running in tmux sessions
  • Long-running agent workflows with subagent dispatches

Code Example

API Error: Stream idle timeout - partial response received
RAW_BUFFERClick to expand / collapse

Bug Description

When the Anthropic API times out mid-stream during a Claude Code session, the tool silently goes idle with no indication to the user that anything went wrong. There is no retry attempt and no error message displayed.

Expected Behavior

When an API stream times out, Claude Code should either:

  1. Automatically retry the request
  2. Or at minimum, display an error message to the user indicating the failure

Actual Behavior

Claude Code silently enters an idle state. The user sees nothing - no error, no prompt, no indication that the previous operation failed. The session just stops responding.

Error Message

API Error: Stream idle timeout - partial response received

This error appears in internal logs but is not surfaced to the user.

Reproduction

This has occurred multiple times in our environment:

  • During long-running agent operations
  • When spawning multiple background subagents
  • The API connection stalls, eventually times out, and Claude Code goes silent

Impact

In our case, a host session went silent for 8 hours after hitting this error. The user had no way to know something went wrong until they manually checked in.

Environment

  • Claude Code CLI
  • Running in tmux sessions
  • Long-running agent workflows with subagent dispatches

extent analysis

TL;DR

Implementing a retry mechanism for the Anthropic API or displaying the "API Error: Stream idle timeout - partial response received" error message to the user can potentially resolve the issue.

Guidance

  • Investigate the Anthropic API documentation for built-in retry mechanisms or error handling guidelines that can be integrated into Claude Code.
  • Modify the Claude Code application to catch and handle the "API Error: Stream idle timeout - partial response received" error, displaying it to the user or triggering a retry attempt.
  • Review the tmux session and long-running agent workflow configurations to ensure they are not contributing to the timeout issue.
  • Consider implementing a heartbeat or periodic check within Claude Code to detect and respond to idle states.

Example

No specific code example can be provided without knowing the implementation details of Claude Code or the Anthropic API. However, a generic approach might involve wrapping API calls in a try-catch block to handle timeouts and trigger retries or error messages.

Notes

The exact implementation details of the retry mechanism or error handling will depend on the specific requirements of the Claude Code application and the Anthropic API. This solution assumes that the "API Error: Stream idle timeout - partial response received" error is a reliable indicator of the timeout issue.

Recommendation

Apply a workaround by modifying Claude Code to handle the "API Error: Stream idle timeout - partial response received" error, as this directly addresses the silent failure issue described.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING