anthropics / anthropics/claude-code

[BUG] ECONNRESET on all requests — curl, node https, and node fetch all succeed to api.anthropic.com on the same machine

Aperta
#91,970 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
api:anthropic area:networking bug duplicate platform:macos
Lingua principale
Python
Stelle
145k
Fork
23.1k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

### Preflight Checklist

- [x] I have searched [existing issues](https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20state%3Aopen%20label%3Abug) 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 v2.1.260 fails with ECONNRESET on every launch. curl, Node's https module, and Node's fetch all reach api.anthropic.com successfully from the same machine at the same time, so the network path is healthy and the failure appears specific to Claude Code's bundled HTTP client.

The Claude desktop app's Code tab fails identically with "Connection problem", while regular Claude chat works normally.

Error on every launch:

Welcome to Claude Code v2.1.260
Unable to connect to Anthropic services
Failed to connect to api.anthropic.com: ECONNRESET

claude --debug produces no additional output beyond the above.

Evidence the network is fine:
- curl -v https://api.anthropic.com → HTTP/2 404, TLS 1.3 handshake completes, valid cert
- node -e "require('https').get('https://api.anthropic.com', r => console.log(r.statusCode))" → 404
- node -e "fetch('https://api.anthropic.com').then(r => console.log(r.status))" → 404

Ruled out:
- Fails on both home Wi-Fi and cellular hotspot
- No VPN — NordVPN removed, systemextensionsctl list → 0 extensions after reboot
- scutil --nc list empty
- No proxy — env | grep -i proxy empty, scutil --proxy shows defaults only
- No ANTHROPIC_* env vars
- Fresh config — rm -rf ~/.claude ~/.claude.json, still fails
- Clean npm reinstall after removing native install at ~/.local/share/claude
- Fails on both 2.1.251 and 2.1.260
- IPv6 disabled at the interface, no change
- DNS switched to

### What Should Happen?

Claude Code should connect to api.anthropic.com and start a session.

### Error Messages/Logs

```shell
$ claude
Welcome to Claude Code v2.1.260

Unable to connect to Anthropic services

Failed to connect to api.anthropic.com: ECONNRESET

Please check your internet connection and network settings.

Note: Claude Code might not be available in your country. Check supported
countries at https://anthropic.com/supported-countries

$ curl -v https://api.anthropic.com
< HTTP/2 404
* SSL connection using TLSv1.3 / AEAD-CHACHA20-POLY1305-SHA256
* Server certificate: CN=api.anthropic.com, issuer Google Trust Services
* server: cloudflare

$ node -e "require('https').get('https://api.anthropic.com', r => console.log('Status:', r.statusCode))"
Status: 404

$ node -e "fetch('https://api.anthropic.com').then(r => console.log('Status:', r.status))"
Status: 404
```

### Steps to Reproduce

1. Run `claude` in Terminal on macOS
2. It fails immediately with "Failed to connect to api.anthropic.com: ECONNRESET"
3. Run `curl -v https://api.anthropic.com` from the same shell — returns HTTP 404 successfully
4.

### Claude Model

None

### Is this a regression?

Yes, this worked in a previous version

### Last Working Version

_No response_

### Claude Code Version

2.1.260 (Claude Code)

### Platform

Anthropic API

### Operating System

macOS

### Terminal/Shell

Terminal.app (macOS)

### Additional Information

claude doctor output:

Running: native (2.1.260)
Platform: darwin-arm64
Config install method: native
Search: OK (bundled)
Auto-updates: enabled
No installation issues found.

Node: v24.14.1
Plan: Pro
Installed via: sudo npm install -g @anthropic-ai/claude-code (which claude → /usr/local/bin/claude)

Additional note: IPv6 to api.anthropic.com resets during the TLS handshake
(curl -6 → "Recv failure: Connection reset by peer"), while IPv4 succeeds.
However, disabling IPv6 at the interface did not resolve the issue, and curl,
node https, and node fetch all fall back to IPv4 without problems.

Also tested: the Claude desktop app's Code tab fails identically with
"Connection problem". Regular Claude chat works normally on the same machine
at the same time.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Start by reproducing the failure with the `claude` entry point on macOS, then compare its connection behavior with the reported `curl`, Node `https`, and Node `fetch` commands. The issue is done when Claude Code starts a session against api.anthropic.com without ECONNRESET and the regression is covered by an appropriate test.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
macos, node.js
Ambito
api, networking
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Attiva
Chiarezza
Da chiarire
Idoneità per principianti
38/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.