[BUG] ECONNRESET errors with IPv6 on Starlink - workaround: force IPv4
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?
Claude Code repeatedly fails with ECONNRESET errors when connecting to the API via IPv6 on Starlink. Claude Desktop works perfectly on the same network connection. Forcing IPv4 resolves the issue.
What Should Happen?
Claude Code should work normally with IPv6 available on Starlink, as Claude Desktop does.
Error Messages/Logs
Symptoms:
All API requests fail with "Unable to connect to API (ECONNRESET)"
Automatic retry mechanism triggers repeatedly (observed up to attempt 7/10)
Even minimal prompts ("say hello") fail with 0 tokens received after 35+ seconds
Same operations work fine in Claude Desktop on identical network
Diagnostics:
Traceroute to api.anthropic.com via IPv6 shows severe latency spike:
Tracing route to api.anthropic.com [2607:6bc0::10]
1 2 ms 2 ms 2 ms customer.frntdeu1.pop.starlinkisp.net
2 51 ms 46 ms 49 ms customer.frntdeu1.pop.starlinkisp.net
3 49 ms 46 ms 49 ms host.starlinkisp.net
4 3063 ms 2943 ms 2532 ms host.starlinkisp.net <-- 3 second latency
5 50 ms 45 ms 45 ms host.starlinkisp.net
6 50 ms 55 ms 44 ms 2605:59c7:9022::1
7 45 ms 45 ms 60 ms 2400:cb00:71:2::3
8 66 ms 59 ms 45 ms 2400:cb00:637:3::
9 54 ms 67 ms 45 ms 2607:6bc0::10
Minimal request test:
> säg hej!
└ Unable to connect to API (ECONNRESET)
Retrying in 2 seconds… (attempt 6/10)
* Slithering… (ctrl+c to interrupt · 35s · ↑ 0 tokens)
API stats from config show significant retry overhead:
lastAPIDuration: 189349 ms
lastAPIDurationWithoutRetries: 29810 ms
Tested without success:
✅ VPN on/off - no difference
✅ DNS resolves correctly (both IPv4 and IPv6)
✅ Router restart
✅ No Anthropic status incidents reported
✅ Claude Desktop works perfectly on same connection
Steps to Reproduce
Use Claude Code over high latency ipv6.
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.12 Claude Code
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
Solution/Workaround:
Forcing Node.js to prefer IPv4 resolves the issue completely:
powershell$env:NODE_OPTIONS = "--dns-result-order=ipv4first"
claude
To make permanent, add to PowerShell profile (notepad $PROFILE):
powershell# Fix for Claude Code ECONNRESET on Starlink (IPv6 routing issue)
$env:NODE_OPTIONS = "--dns-result-order=ipv4first"
Root cause:
Starlink's IPv6 routing to Anthropic's API has unstable/high-latency hops causing connection resets. Claude Desktop likely defaults to IPv4 or has more robust connection handling for IPv6.
Suggestions:
- Document this workaround for users on satellite/IPv6-problematic networks
- Consider adding automatic IPv4 fallback when IPv6 connections fail repeatedly
- Increase connection timeout or improve retry logic for high-latency networks
- Align connection handling with Claude Desktop's (more resilient) implementation
Affected users:
Likely affects other Starlink users and potentially other satellite internet providers with IPv6 routing issues.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗