[BUG] Claude Code fails on networks with broken IPv6 (ECONNRESET)

Resolved 💬 3 comments Opened Jan 23, 2026 by natesute Closed Jan 26, 2026

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?

Summary
Claude Code (both VS Code extension and CLI) fails to connect to api.anthropic.com on networks that advertise IPv6 locally but lack upstream IPv6 connectivity. Curl and browsers work fine due to automatic fallback to IPv4, but Bun appears to prefer IPv6 and doesn't fall back gracefully.
Environment

macOS (Apple Silicon)
Claude Code VS Code Extension v2.1.17
Bun 1.3.5
Router: TP-Link Archer AX1500

Error
Unable to connect to API (ECONNRESET)
Retrying in 5 seconds… (attempt 4/10)
Root Cause
The network's router hands out local IPv6 addresses (via SLAAC) but has no upstream IPv6 from the ISP. This creates a "half-configured" IPv6 state:

api.anthropic.com has an AAAA record (IPv6: 2607:6bc0::10)
statsig.anthropic.com has no AAAA record — this works fine
Bun tries IPv6 first for api.anthropic.com, connection gets reset, doesn't fall back to IPv4

Evidence
IPv6 curl test (fails):
curl -v --ipv6 https://api.anthropic.com -m 10

  • Trying [2607:6bc0::10]:443...
  • Connected to api.anthropic.com (2607:6bc0::10) port 443
  • Recv failure: Connection reset by peer

IPv4 curl test (works):
curl -4 -I https://api.anthropic.com
HTTP/2 404 ← connects fine
Verbose Bun fetch shows statsig works, API fails:
[fetch] > HTTP/1.1 POST https://statsig.anthropic.com/...
[fetch] < 202 Accepted ← works (no IPv6 record)

Unable to connect to API (ECONNRESET) ← api.anthropic.com fails
Attempted Fixes (none worked)

sudo networksetup -setv6off Wi-Fi — Bun ignores system IPv6 setting
Disabled IPv6 on router — router lacks full disable option for LAN
Added IPv4 to /etc/hosts — system still returns both addresses
pfctl firewall rule to block IPv6 — Bun bypasses it

Suggested Fix
Bun/Claude Code should either:

Implement Happy Eyeballs (RFC 8305) to race IPv4/IPv6 and use whichever connects first
Respect system-level IPv6 disable settings
Provide a config option to force IPv4

Workaround
Using a mobile hotspot (which has working IPv6 or doesn't advertise it) works fine.

What Should Happen?

Claude Code should connect successfully to the API on networks with broken/partial IPv6, the same way curl and web browsers do. It should either fall back to IPv4 when IPv6 fails, or respect system-level IPv6 settings.

Error Messages/Logs

Unable to connect to API (ECONNRESET)
Retrying in 5 seconds… (attempt 4/10)


[fetch] > HTTP/1.1 POST https://api.anthropic.com/v1/messages
...
Error: Connection error.
    at makeRequest (/$bunfs/root/claude:161:4548)

Steps to Reproduce

  1. Connect to a network that advertises IPv6 locally but lacks upstream IPv6 connectivity (common with routers that have IPv6 LAN enabled but no IPv6 from ISP)
  2. Verify broken IPv6 with: curl -v --ipv6 https://api.anthropic.com -m 10 — should fail with "Connection reset by peer"
  3. Verify IPv4 works with: curl -4 -I https://api.anthropic.com — should succeed
  4. Run claude or use Claude Code VS Code extension
  5. Send any message
  6. Observe "Unable to connect to API (ECONNRESET)" error

Key detail: api.anthropic.com has an AAAA record (2607:6bc0::10), while statsig.anthropic.com does not. Claude Code successfully connects to statsig but fails on the main API.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.17

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

Unable to verify if latest version due to same connectivity issue (claude update fails with "socket connection was closed unexpectedly").

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗