[ERROR] Error streaming, falling back to non-streaming mode: Connection error.
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?
With CLAUDE_CODE_MAX_RETRIES=1, it resets instantly on attempt 1. With the default budget it retries 15x and either hangs for minutes or eventually errors.
What I ruled out (all tested, none changed the result)
- Phone hotspot on the same machine → works perfectly. Home Wi-Fi → resets every time. Same laptop, same session.
- curl.exe -I https://api.anthropic.com → instant clean 404.
- Streamed POST to /v1/messages via curl (dummy key) → instant clean 401 invalid x-api-key. Same network, same moment Claude Code was resetting.
- IPv6 disabled on the Wi-Fi adapter → no change.
- ipconfig /flushdns → no change.
- Malwarebytes (Free; all real-time/web protection already off) quit → no change.
- Native install and npm install → identical failure (different HTTP stacks, same result).
- claude --settings "{}" --strict-mcp-config -p "hi" (no plugins, no MCP, no statusline) → no change.
- claude doctor → "No installation issues found."
- UNDICI_NO_H2=1 (force HTTP/1.1) → no change.
Diagnosis
Network path and auth are provably healthy — curl (including a streamed POST) succeeds over the exact same home Wi-Fi, and the same machine works flawlessly on a phone hotspot. The failure is specific to the Claude Code client on this machine + home network, survives a full client swap and a config-stripped run, and only affects the streaming connection.
Working CF-RAY (from the successful curl): a29139ea0923dd26-YUL (Cloudflare Montréal edge)
Appears related to the existing Windows ECONNRESET cluster: #13657, #62045, #83994.
What Should Happen?
Claude Code should maintain a working streaming connection to api.anthropic.com whenever the same machine and network can reach the API by other means — as demonstrated here by curl (including a streamed POST to /v1/messages) succeeding over the identical home Wi-Fi, and by Claude Code working flawlessly on a phone hotspot from the same laptop. Instead, the streaming connection is reset (ECONNRESET) on every request over the home network.
Error Messages/Logs
Steps to Reproduce
Steps to reproduce
- On Windows 11, run Claude Code on a home Wi-Fi connection:
claude -p "hi" - Observe
API Error: Unable to connect to API (ECONNRESET)on every request. - Confirm the network path is healthy from the same shell:
curl.exe -I https://api.anthropic.comreturns an instant404, and a streamedPOSTto/v1/messages(with a dummy key) returns an instant401. - Connect the same machine to a phone hotspot and run
claude -p "hi"again → succeeds every time. - Switch back to home Wi-Fi → resets return immediately.
To make failures surface instantly instead of retrying: set CLAUDE_CODE_MAX_RETRIES=1 (or $env:CLAUDE_CODE_MAX_RETRIES = "1" in PowerShell) before step 1.
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.226
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗