Infinite retry loop when API times out during thinking phase

Resolved 💬 2 comments Opened Apr 15, 2026 by Jada-Q Closed May 24, 2026

Description

Claude Code enters an infinite retry loop when the API connection drops during the thinking/reasoning phase. The same user prompt is re-executed repeatedly with no retry limit.

Reproduction

  1. Send a prompt that triggers multiple parallel WebSearch calls + extended thinking (e.g., a research question requiring 3+ web searches)
  2. Model: Opus 4.6
  3. The API call completes the tool-use phase (WebSearch results return successfully) but disconnects during the "Bloviating..." (thinking) phase
  4. Claude Code automatically retries the entire API call from scratch
  5. This repeats indefinitely — in my case, 31 times before I manually interrupted with esc

Evidence

Each retry shows a full Claude Code header (version, model, working directory), confirming the client is restarting the API call, not resuming:

!Screenshot

Claude Code v2.1.108
Opus 4.6 · Claude Pro
/Users/...

> [same prompt]

● Web Search("AI model companies 2026...")
  └ Found 10 results
● Web Search("AI agents autonomous coding...")  
  └ Did 1 search in 10s
● Web Search("AI industry direction 2026...")
  └ Did 1 search in 8s

✱ Bloviating… (17s · ↓ 69 tokens · thinking)
────────────────────────────────────────
[repeats with full header again]

Expected behavior

  • Retry with exponential backoff, capped at a reasonable max (e.g., 3-5 retries)
  • After max retries, show an error message to the user instead of silently looping
  • Ideally, resume from the last successful checkpoint (tool results already received) rather than replaying the entire turn

Environment

  • Claude Code: v2.1.108
  • Model: Opus 4.6 (claude-opus-4-6)
  • Plan: Claude Max
  • OS: macOS 24.6.0 (Darwin), Apple M4 Pro
  • No custom hooks or loops causing the retry — verified by inspecting all hook scripts and settings

Impact

  • Wastes significant API quota (31× the same 3 web searches + thinking)
  • Blocks the user from working until manually interrupted
  • No indication to the user that retries are happening — looks like duplicate responses in the same conversation

View original on GitHub ↗

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