Skip to content

[Bug] ECONNRESET on Windows during API stream after first chunk received #84072

Description

@malikjakexgroup

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:

  1. /v1/messages request is dispatched successfully
  2. The API response begins
  3. “Stream started - received first chunk”
  4. First byte arrives in approximately 1–4 seconds
  5. “Stream connection error (ECONNRESET) — retrying streaming”
  6. 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:

  1. A Claude Code v2.1.222 Windows-specific streaming issue
  2. A regression in the Claude Code networking client
  3. An issue involving the authenticated streaming connection
  4. HTTP streaming behavior or connection resets after the first response chunk
  5. 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:

  1. /v1/messages request is dispatched successfully
  2. The API…
    Note: Content was truncated.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleIssue is inactive

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions