[BUG] Retries after "Connection error" fail on fresh sockets for ~3 min (→ ECONNRESET) while new requests succeed instantly — ESC + "continue" always fixes it (macOS 27, 2.1.301)

Status Open
Reported on v2.1.301
Maintainer reply None cached
Activity 0 comments · opened Oct 15, 2026

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?

Since 2026-10-06, sessions regularly end a turn with API Error: Connection dropped (ECONNRESET). The --debug log shows the original request fails within 25–85 ms with Connection error. and no HTTP status. All of the automatic retries then fail the same way, each on a fresh socket ("Stale connection — disabling keep-alive for retry"). The error appears once the 11 attempts are used up, about 3 minutes later.

What I typed next always worked. Across 25 drops, the next message I sent ("continue", "try again", …) succeeded every time, usually within 2–5 s. Five of those messages went out 0 s after the error, right after ~3 minutes of failed retries. Pressing ESC during the retries and typing "continue" also fixes it reliably.

The network is healthy while this happens. During the 00:13:49–00:15:00 incident below, another Claude Code session on the same Mac, network and API IP (160.79.104.10) got 11 successful responses.

Debug log, one incident (2.1.301, native, --debug). It recovered on attempt 8 this time:

21:13:49.680Z [Stall] tool_dispatch_end tool=Bash outcome=ok durationMs=1181
21:13:49.703Z [dispatch] sent anthropic-dispatch-id=v2d
21:13:49.772Z [ERROR] API error (attempt 1/11): undefined Connection error.
21:13:49.773Z [WARN] [dispatch] connection error with anthropic-dispatch-id=v2d; retrying once with anthropic-dispatch-id=v2p
21:13:49.773Z Stale connection — disabling keep-alive for retry
21:13:49.847Z [ERROR] API error (attempt 1/11): undefined Connection error.
21:13:50.531Z [ERROR] API error (attempt 2/11): undefined Connection error.
21:13:51.626Z [ERROR] API error (attempt 3/11): undefined Connection error.
21:13:53.806Z [ERROR] API error (attempt 4/11): undefined Connection error.
21:13:58.726Z [ERROR] API error (attempt 5/11): undefined Connection error.
21:14:06.978Z [ERROR] API error (attempt 6/11): undefined Connection error.
21:14:23.314Z [ERROR] API error (attempt 7/11): undefined Connection error.
21:15:00.456Z [API REQUEST] /v1/messages ...
21:15:01.196Z [API:timing] first byte after 743ms

The earlier incident on the same day (21:06:54Z) had the same pattern and recovered on attempt 6.

Kernel view of the failed attempts (log show, tcp_connection_summary for the Claude Code process during a full 11/11 failure). Each attempt is one short connection with the same shape:

Duration: 0.07 sec  Conn_Time: 0.022 sec  bytes in/out: 1780/5306  pkt rxmit: 0
SYN in/out: 1/1  FIN in/out: 0-1/0  RST in/out: 0/0

TCP connects, there are no retransmits, and no RST is seen in either direction. The connection is closed about 70 ms in, sometimes by the peer's FIN (LAST_ACK) and sometimes by the client (FIN_WAIT_1). Meanwhile, existing long-lived connections from the same process stay up, including one open for 42 minutes.

Pattern from 26 drops (session transcripts, 2026-10-06 → 2026-10-15):

  • Every final error came 2.8–3.2 min after the original request, which is the retry budget running out.
  • The failing request almost always comes right after a tool result (17×) or after my reply to a question (9×).
  • Only one drop happened before 2026-10-06 ("Connection lost mid-response", 2026-09-21).

What Should Happen?

When a fresh request succeeds on the first try, the automatic retry of a failed request should succeed too, without needing ESC + "continue". At least the retries should not keep failing on fresh sockets for 3 minutes while new requests from the same and other processes work.

Error Messages/Logs

API Error: Connection dropped (ECONNRESET)
[ERROR] API error (attempt N/11): undefined Connection error.

Client request IDs of failed attempts (2026-10-15):

  • 26a9b192-c368-4bd1-a4de-87993366e71d: first failure, 21:06:54.873Z
  • cb04ea7d-bc08-4606-94b2-a88cfee158db: first retry (v2p), 21:06:54.899Z
  • c99cf49d-ad84-4778-b178-62c4d65bddf2: attempt 7, 21:14:23.241Z

Steps to Reproduce

It's intermittent, happening several times a day in long sessions with many tool calls:

  1. Run claude --debug on macOS 27 (native build) and work normally with frequent Bash tool calls.
  2. At some point the request after a tool result fails within ~70 ms with Connection error.
  3. Every retry fails on a fresh socket. After 11 attempts (~3 min) you get Connection dropped (ECONNRESET).
  4. Press ESC (or wait for the error), type "continue", and it succeeds immediately.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

Unknown. There were no drops before 2026-10-06; 2.1.29x was current then.

Claude Code Version

2.1.301 (Claude Code), native install

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Other

Additional Information

  • macOS 27 (Darwin 27.0.0), Apple Silicon, Wi-Fi (en0, MTU 1500), home router, no proxy, no VPN active.
  • Ruled out locally: Wi-Fi was stable at the drop times (RSSI −57 to −61 dBm, no disassociation or roaming), DNS was clean, and there was no system proxy. A previously installed Tailscale was removed; drops started before it was installed.
  • Possibly related: #94225 (fresh TLS handshakes to 160.79.104.10 reset on some paths, linked to ClientHello size/MTU), #100706 (ECONNRESET at MTU 1500, OK at ≤1492), #100353 (keep-alive disabled after one connection error). This report differs in that the kernel shows no RST, and new requests keep working while the retried request keeps failing.

View original on GitHub ↗