Frequent ECONNRESET failures with Opus 4.6 (1M context)
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?
Description
Frequent ECONNRESET errors during extended conversations with claude-opus-4-6[1m]. The API drops the TCP connection, triggering retry
loops (up to attempt 6-10 of 10). Sometimes recovers after retries, sometimes requires restarting the conversation entirely.
Environment
- CLI version: 2.1.96
- Model: claude-opus-4-6[1m] (1M context)
- Platform: macOS Darwin 24.5.0
- Network: Stable — Docker builds, K8s deploys, and other HTTP traffic work fine during failures
Reproduction
- Start a conversation with Opus 4.6 (1M context)
- Use heavy tool use (multi-file reads, Agent subagents, codebase exploration)
- Continue until context reaches ~100K-500K tokens
- Failures start appearing: Unable to connect to API (ECONNRESET)
Frequency
~20 failures over a 24-hour period (2026-04-07 to 2026-04-08). Not transient — retries often fail multiple times before recovering.
Error Output
Unable to connect to API (ECONNRESET)
Retrying in 10 seconds… (attempt 6/10)
Notes
- Seems correlated with larger context sizes and heavy tool use
- Local network is confirmed stable during failures
- Other models/endpoints are not tested for comparison
What Should Happen?
API connections should remain stable throughout extended conversations regardless of context size. When using the 1M context model
with heavy tool use, the connection should not drop. If the server needs to close a connection, it should do so gracefully — not with
a TCP reset — and the client should be able to reconnect on the first retry, not after 6+ attempts.
Error Messages/Logs
⏺ Unable to connect to API (ECONNRESET)
Retrying in 10 seconds… (attempt 1/10)
Unable to connect to API (ECONNRESET)
Retrying in 10 seconds… (attempt 2/10)
Unable to connect to API (ECONNRESET)
Retrying in 10 seconds… (attempt 3/10)
Unable to connect to API (ECONNRESET)
Retrying in 10 seconds… (attempt 4/10)
Unable to connect to API (ECONNRESET)
Retrying in 10 seconds… (attempt 5/10)
Unable to connect to API (ECONNRESET)
Retrying in 10 seconds… (attempt 6/10)
This repeats ~20 times over a 24-hour period. Occurs mid-conversation during tool use — not at startup or idle.
Steps to Reproduce
⏺ 1. Start Claude Code CLI (v2.1.96) with model claude-opus-4-6 (1M context)
- Open a conversation in a medium-to-large codebase (~50+ files)
- Perform heavy tool use that grows context rapidly:
- Read multiple large files (500+ lines each)
- Dispatch Agent subagents for codebase exploration
- Read a large spec/document (~1400 lines, ~25K tokens)
- Write a large output file (~800 lines)
- Continue the conversation past ~100K tokens of context
- At some point during a tool call or response, the connection drops with ECONNRESET
- Retries fail repeatedly (up to attempt 6-10 of 10) before eventually recovering or timing out
Notes on reproduction:
- Not deterministic — happens intermittently but frequently (~20 times in 24 hours)
- More likely during heavy parallel tool use (multiple file reads, Agent spawns)
- Never happens at conversation start — only after significant context accumulation
- Local network remains stable during failures (other HTTP traffic works fine)
- Observed over multiple separate conversations, not just one session
Claude Model
Not sure / Multiple models
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.96 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
- No proxy, no VPN — direct internet connection
- Claude Code installed via npm
- Using multiple MCP servers (GenMem, Playwright, Serena, Context7, Sequential Thinking)
- Conversation typically involves 10-30 tool calls before failure occurs
Observations:
- The failure is always ECONNRESET — never a timeout, never a 429, never a 500. The TCP connection is reset by the remote side.
- Retry backoff doesn't help — if attempt 1 fails, attempts 2-6 usually fail too, suggesting the issue is sustained (seconds to
minutes), not a single dropped packet.
- When it recovers, it works fine for a while before failing again — no gradual degradation.
- This pattern started recently. The same workflow (heavy tool use, large context, Opus 4.6 1M) worked without these failures in prior
weeks.
- Not related to specific tool types — fails during file reads, Agent dispatches, and plain text responses.
Hypothesis: Possible connection pooling or keep-alive issue on the API server side when handling large-context 1M model requests. The
sustained retry failures suggest the server is rejecting new connections temporarily, not just dropping one.
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗