Bug Description
Title: Persistent ECONNRESET during Claude Code streaming responses on Windows — first chunk arrives, then stream resets
Environment:
- Windows 10/11
- Claude Code v2.1.222
- npm global installation
- Reproduced in both the VS Code extension and Claude Code terminal
- Claude.ai authentication with an active Max subscription
Symptom:
Most prompts, including trivial prompts such as “hi”, “what is AI”, and “Say only: OK”, initially fail with:
“Unable to connect to API (ECONNRESET)”
or:
“API error · Retrying in 0s · attempt X/10”
Claude Code repeatedly retries. Some requests eventually succeed after multiple retries, but even trivial prompts can take several minutes. One simple response took approximately 3 minutes 39 seconds.
The issue began after a Claude Code session was interrupted during a project and a new session was started. Initially, the VS Code extension was affected while the terminal still worked, but the terminal later developed the same problem.
Debug evidence:
Claude Code was started with:
claude --safe-mode --debug api
The debug log repeatedly shows this sequence:
/v1/messages request is dispatched successfully
- The API response begins
- “Stream started - received first chunk”
- First byte arrives in approximately 1–4 seconds
- “Stream connection error (ECONNRESET) — retrying streaming”
- The same behavior repeats across multiple retries
This indicates that:
- DNS resolution succeeds
- HTTPS/TLS connectivity succeeds
- Authentication succeeds
- The request reaches the Anthropic API
- The server begins sending a response
- The response stream is then reset shortly after it begins
The reset occurs shortly after the first response chunk, rather than after a long idle period.
Troubleshooting already performed:
claude doctor reports no installation issues
- Claude Code was updated to v2.1.222
claude auth status confirms that the user is logged in
- WinHTTP proxy is set to direct access
- No
HTTP_PROXY, HTTPS_PROXY, or related proxy environment variables were found
- Tested in a clean empty folder
- Tested with
claude --safe-mode
- Safe Mode disabled MCP, plugins, hooks, CLAUDE.md, skills, agents, and other customizations, but the issue persisted
- Therefore, MCP, Context7, plugins, hooks, project configuration, and CLAUDE.md are unlikely to be the cause
- Tested on both the normal home connection and a mobile hotspot
- Fully terminated existing Claude processes and relaunched Claude Code
- The issue persisted after restarting Claude Code
- Basic
curl.exe -v https://api.anthropic.com connectivity succeeds:
- DNS resolves
- HTTPS connects
- Anthropic responds normally with HTTP 404 because GET
/ is not the API endpoint
- This confirms that basic connectivity to the Anthropic API host is available, although it does not fully test Claude Code’s authenticated streaming path
Important:
The current Claude.ai login belongs to an organization account, and logging out may prevent the user from signing back in immediately. Therefore, the authentication session has intentionally not been deleted or reset.
Request:
Please investigate whether this may be caused by:
- A Claude Code v2.1.222 Windows-specific streaming issue
- A regression in the Claude Code networking client
- An issue involving the authenticated streaming connection
- HTTP streaming behavior or connection resets after the first response chunk
- An account, organization, regional routing, or service-side issue
The key diagnostic pattern is:
“Stream started - received first chunk”
followed almost immediately by:
“Stream connection error (ECONNRESET) — retrying streaming”
Debug log session ID:
624fcb16-162c-4b27-a111-7b4f664ece4cTitle: Persistent ECONNRESET during Claude Code streaming responses on Windows — first chunk arrives, then stream resets
Environment:
- Windows 10/11
- Claude Code v2.1.222
- npm global installation
- Reproduced in both the VS Code extension and Claude Code terminal
- Claude.ai authentication with an active Max subscription
Symptom:
Most prompts, including trivial prompts such as “hi”, “what is AI”, and “Say only: OK”, initially fail with:
“Unable to connect to API (ECONNRESET)”
or:
“API error · Retrying in 0s · attempt X/10”
Claude Code repeatedly retries. Some requests eventually succeed after multiple retries, but even trivial prompts can take several minutes. One simple response took approximately 3 minutes 39 seconds.
The issue began after a Claude Code session was interrupted during a project and a new session was started. Initially, the VS Code extension was affected while the terminal still worked, but the terminal later developed the same problem.
Debug evidence:
Claude Code was started with:
claude --safe-mode --debug api
The debug log repeatedly shows this sequence:
/v1/messages request is dispatched successfully
- The API…
Note: Content was truncated.
Bug Description
Title: Persistent ECONNRESET during Claude Code streaming responses on Windows — first chunk arrives, then stream resets
Environment:
Symptom:
Most prompts, including trivial prompts such as “hi”, “what is AI”, and “Say only: OK”, initially fail with:
“Unable to connect to API (ECONNRESET)”
or:
“API error · Retrying in 0s · attempt X/10”
Claude Code repeatedly retries. Some requests eventually succeed after multiple retries, but even trivial prompts can take several minutes. One simple response took approximately 3 minutes 39 seconds.
The issue began after a Claude Code session was interrupted during a project and a new session was started. Initially, the VS Code extension was affected while the terminal still worked, but the terminal later developed the same problem.
Debug evidence:
Claude Code was started with:
claude --safe-mode --debug api
The debug log repeatedly shows this sequence:
/v1/messagesrequest is dispatched successfullyThis indicates that:
The reset occurs shortly after the first response chunk, rather than after a long idle period.
Troubleshooting already performed:
claude doctorreports no installation issuesclaude auth statusconfirms that the user is logged inHTTP_PROXY,HTTPS_PROXY, or related proxy environment variables were foundclaude --safe-modecurl.exe -v https://api.anthropic.comconnectivity succeeds:/is not the API endpointImportant:
The current Claude.ai login belongs to an organization account, and logging out may prevent the user from signing back in immediately. Therefore, the authentication session has intentionally not been deleted or reset.
Request:
Please investigate whether this may be caused by:
The key diagnostic pattern is:
“Stream started - received first chunk”
followed almost immediately by:
“Stream connection error (ECONNRESET) — retrying streaming”
Debug log session ID:
624fcb16-162c-4b27-a111-7b4f664ece4cTitle: Persistent ECONNRESET during Claude Code streaming responses on Windows — first chunk arrives, then stream resets
Environment:
Symptom:
Most prompts, including trivial prompts such as “hi”, “what is AI”, and “Say only: OK”, initially fail with:
“Unable to connect to API (ECONNRESET)”
or:
“API error · Retrying in 0s · attempt X/10”
Claude Code repeatedly retries. Some requests eventually succeed after multiple retries, but even trivial prompts can take several minutes. One simple response took approximately 3 minutes 39 seconds.
The issue began after a Claude Code session was interrupted during a project and a new session was started. Initially, the VS Code extension was affected while the terminal still worked, but the terminal later developed the same problem.
Debug evidence:
Claude Code was started with:
claude --safe-mode --debug api
The debug log repeatedly shows this sequence:
/v1/messagesrequest is dispatched successfullyNote: Content was truncated.