What is the exact message?
Socket is closedAnthropic describes it as the connection carrying a streaming response being closed while the response was still arriving. On a version before v2.1.214 it ended the turn; on a current one it is a failure Claude Code may recover from on its own.
What does it mean?
The connection carrying a streaming response was closed while the response was still arriving. The pipe was cut after the response had started, which is why the message talks about the socket rather than about a request that failed.
What Claude Code does about it depends on how far the response had progressed. Anthropic documents three outcomes: Claude Code retries the request, it keeps what Claude produced and continues from there, or it ends the turn. Which one you get is decided by the automatic retry rules, not by the message text.
What causes it
- A corporate proxy on Windows dropping the tunnel. Anthropic names this as the most common cause: the tunnel is established, the response starts, and then the proxy closes it partway through.
- An older Claude Code, which made it worse. Before v2.1.214 Claude Code did not retry this failure, so a proxy that dropped one response ended the whole turn instead of costing one retry.
- A gateway or network device doing the same thing. Anthropic's own advice after updating is to check the proxy setup, which is where a device closing established connections shows up.
How do I fix it?
Already on v2.1.214 or later? Then there may be nothing to fix. Claude Code retries this failure on its own, so a single Socket is closed that the turn recovered from needs no action. The steps below are for the case where it ends every turn.
- Update Claude Code, then send your message again. That is Anthropic's first step verbatim: update to v2.1.214 or later with
claude update, then send the message again. Before that version the failure was not retried at all. - If turns keep failing behind the same proxy, examine the proxy. Anthropic's next step is to work through its
Unable to connect to APIchecks and the proxy setup in network configuration, because the hop that closes the socket is the thing to change. - Test the path from the same shell.
curl -I https://api.anthropic.comshows whether a request survives end to end; on Windows PowerShell usecurl.exe, not the built-in alias. Ifcurlsucceeds and Claude Code still fails, Anthropic says the cause is usually something between the runtime and the network rather than the network itself. - Find out whether a proxy is configured at all. Anthropic documents that Claude Code reads
https_proxy,HTTPS_PROXY,http_proxyandHTTP_PROXY, using the first one set, and that a value in a settings file'senvblock is read too. Check all four and the settings file:env | grep -i proxy, orGet-ChildItem Env:*proxy*in PowerShell.
How do I know it is fixed?
- A turn that used to stop with
Socket is closednow finishes, on the retry Claude Code makes by itself. - Long replies stream all the way to the end through the same proxy, rather than ending partway.
- If you were on a version before v2.1.214,
claude updatesucceeds and the next drop costs a retry instead of the turn.
Where these answers come from
- The meaning, the Windows corporate proxy cause, the three possible outcomes, the v2.1.214 change and both fix steps: Anthropic's error reference, read November 20, 2026.
- Which failures are retried and which are not: Anthropic's automatic retries section, read November 20, 2026.
- The proxy setup, the
curlhost check and the order Claude Code reads the proxy variables in: Anthropic's network configuration page, read November 20, 2026.
Common questions
What does Socket is closed mean in Claude Code?
The connection carrying a streaming response was closed while the response was still arriving. Anthropic names a corporate proxy on Windows dropping an established tunnel mid-response as the most common cause.
Do I have to retry it myself?
Usually not. Anthropic documents that depending on how far the response had progressed, Claude Code retries the request, keeps what Claude produced, or ends the turn, under its automatic retry rules.
Why does updating matter for this one?
Before v2.1.214 Claude Code did not retry this failure, and the turn stopped with an error containing Socket is closed. Updating to v2.1.214 or later is Anthropic's first step.
What if it keeps happening after I update?
Anthropic's next step is to work through its Unable to connect to API checks and the proxy setup in network configuration, because the proxy the response passes through is what is closing the socket.
Is this the same as ECONNRESET?
They are neighbours, not synonyms. ECONNRESET is the connection being reset, and it appears in a message that names the errno. Socket is closed is the documented description of a stream cut off while it was still arriving.