[BUG] Transient server errors MUST NOT kill subagents
reopens: https://github.com/anthropics/claude-code/issues/65882
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?
Currently if any server error happens, e.g. Overloaded, Rate limited (not your usage limit) or weekly limit etc will delete ALL subagents (that currently do not have a monitor running)
This is a massive problem because upon restarting the agent, they have to start from scratch, which wastes 200k-500k tokens.
In the case of Overloaded or Rate limited (not your usage limit) these are genuinely not the Users fault. The former is Anthropic's fault, the latter is Claude code being programmed badly and tripping its own backends rate limit during regular usage.
Wasting large token budgets on this is just unacceptable.
Further problem: these subagents are wrongfully shown to the main agent as "Completed" creating much confusion.
What Should Happen?
Subagents that get stopped due to a API or Network error are NOT completed. They must NOT be deleted from the list of subagents/tasks. Instead they should be PAUSED.
The user should have a hotkey to revive a subagent that got paused, this way no work is lost. The user should also get a hotkey to revive ALL subagents that are currently paused, importantly this should be done with a 10 second delay between each agent, as otherwise this will just cause another Rate limited (not your usage limit) error.
Further a paused agent should not be shown to the main agent as completed. Instead they should be shown as paused due to the error. The main agent should have their own function they can call in order to revive a paused subagent
In general the same applies for usage limits. Once the user has authorised extra usage, having to restart multiple subagents that each already worked for 500k tokens, does incur significant, and unfair cost.
Steps to Reproduce
requires Anthropic's to be overloaded, or a rate or usage limit to be reached while a subagent is active.
Claude Model
All models
Is this a regression?
No, this never worked
Claude Code Version
2.1.165 (Claude Code)
Platform
Anthropic API
Operating System
Other Linux
Terminal/Shell
some linux terminal app e.g. gnome Console or Konsole
4 Comments
this is a real pain point. A couple of things worth checking before this gets triaged further:
You're on v2.1.165. Several relevant fixes landed after that:
Agent terminated early due to an API errormessage instead of silently returning the API error text to the main agent as if it were the subagent's actual result which sounds like exactly the "wrongfully shown as Completed" issue described above.CLAUDE_CODE_RETRY_WATCHDOG=1retries 429/529 indefinitely instead of killing the turn.Could you retest on the latest version (2.1.226) and see if the core "deleted + shown as Completed" behavior still reproduces? If it does, that's a real bug in current versions. If it doesn't, this issue is likely stale and the remaining ask is narrower: a hotkey to revive all paused subagents with a staggered 10s delay between each, and confirmation of whether background (nonforeground) subagents get the same resume path as foreground ones the docs I found don't fully spell that out.
Thanks for the detailed writeup. I tried to reproduce this on 2.1.233 (Linux) by pointing the CLI at a local endpoint that returned
529 Overloadedonly for a background subagent's requests, while the main agent kept working normally.What I saw on 2.1.233:
What's still missing is what you're actually asking for: it doesn't pause and resume itself once the API recovers, error-stopped agents drop off the active list, and there's no single "revive everything that stopped" action. Your point about spacing revives out so they don't immediately re-trip the rate limit is a good one.
Keeping this open as a feature request for automatic resume-after-recovery and a staggered revive-all.
🤖 Generated with Claude Code
Adding field data on the retry-budget question from @bcherny's repro, since I hit this hard over the last 24h on a real workload rather than a synthetic endpoint.
Setup: Max plan, Claude Code 2.1.217→2.1.229 via the Claude Desktop app, macOS. Orchestrator session that fans work out to subagents and merges the results.
Counts, extracted from my session transcripts (
~/.claude/projects/**/*.jsonl, matching the structuredapi_error/isApiErrorMessagerecords rather than raw string grep, which false-positives badly on token counts):529 Overloadedtotal; 83 of them on 2026-08-18 alone. First one 2026-08-17 23:07 UTC, most recent 2026-08-18 17:50 UTC.The part relevant to "does the retry budget hold": these don't arrive as isolated blips, they arrive as sustained walls.
| Window (UTC) | Duration | 529s |
|---|---|---|
| 2026-08-17 23:07:22–23:07:36 | 14 s | 5 |
| 2026-08-18 16:18:34–16:32:55 | 14 min 21 s | 18 |
| 2026-08-18 17:11:27–17:16:01 | 4 min 34 s | 10 |
So a ~11-attempt exponential backoff — which is a perfectly reasonable budget against a blip — gets exhausted well inside a 14-minute overload window. The behaviour you reproduced isn't an edge case; it's the normal shape of a real capacity event. Any bounded-attempt strategy that doesn't outlast ~15 minutes will keep killing subagents in production even though it passes a short-outage test.
Why the wasted-token framing understates it. The original report is about burning 200k–500k re-running subagents, which is real. But the worse cost is structural: when the orchestrator turn dies, every subagent result behind it is stranded un-merged. The lanes did the work, and there's no surviving place to reconcile it from, so the whole pipeline stalls rather than one agent restarting. I lost most of a working day to this on billable client work, and the workaround — escalating to a larger model just to get a turn to complete — consumes plan limits faster, so the outage compounds into a quota problem.
Two smaller observations that may help triage:
retryAttempt/retryInMsare present in the transcript records — so this is budget exhaustion, not missing retry logic.ECONNRESET/ connection-dropped events (~140 across the same two days, vs. a normal baseline near zero). I can't prove those are server-side, so treat it as correlation only, but they cluster in the same minutes.Anthropic's own support widget was displaying "Degraded performance for multiple models" (updated 2026-08-18 17:12 UTC), which falls inside the third burst above, so the capacity event itself is acknowledged. Filing here strictly about the client-side survival behaviour.
Anyone wanting to contribute their own numbers to this thread:
Happy to share the full timestamp list or redacted transcript records if useful for the repro.
I can confirm that on version Claude Code v2.1.234 the bug still exists