anthropics / anthropics/claude-code

[BUG] Windows: ECONNRESET on first Claude Code prompt despite working HTTPS

Đang mở
#93,804 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
api:anthropic area:networking duplicate platform:windows
Ngôn ngữ chính
Python
Star
145k
Fork
23.1k
Chỉ số merge pull request
Chỉ số pull request đang chờ

Mô tả

### 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-bug-report.md](https://github.com/user-attachments/files/32141423/claude-code-bug-report.md)

[claude-code-bug-report.md](https://github.com/user-attachments/files/32141433/claude-code-bug-report.md)

## Environment

- OS: Windows 11
- Claude Code CLI: 2.1.268
- VS Code extension: Claude Code 2.1.269
- Node.js: v22.13.0
- Installation: official winget/native Windows installer

## Problem

Claude Code fails already on the first prompt with:

Connection dropped (ECONNRESET)

The issue occurs in multiple projects and also when using a mobile hotspot.

## Network tests

The following work correctly:

- DNS resolution for api.anthropic.com
- TCP connection to port 443
- TLS handshake
- curl request to https://api.anthropic.com/
- Node HTTPS request to https://api.anthropic.com/

No HTTP_PROXY, HTTPS_PROXY or custom CA environment variables are configured.

## Debug log

The Claude Code debug log contains:

- mTLS: Creating HTTPS agent with custom certificates
- Policy limits: fetch failed (http) from api.anthropic.com - socket hang up
- API REQUEST /v1/messages
- API error: Connection error
- ECONNRESET
- CCRClient: unknown certificate verification error
- SSETransport: socket connection was closed unexpectedly

The issue is reproducible before any project-specific operation is performed.

### What Should Happen?

Claude Code should maintain a stable connection and complete the first prompt successfully. The request should not fail with ECONNRESET, socket hang up, or certificate verification errors. Bootstrap, policy checks, MCP registry, CCR/SSE streaming, and /v1/messages should complete normally, with retries only for genuine transient failures.

### Error Messages/Logs

```shell

```

### Steps to Reproduce

1. Install Claude Code CLI 2.1.268 on Windows.
2. Sign in with a valid Claude account.
3. Open PowerShell in any project directory.
4. Start Claude Code with:
```powershell
claude --debug --debug-file "$env:TEMP\claude-debug.log"
```
5. Enter a minimal prompt such as:
```text
ciao
```
6. Wait for the request to start.
7. The connection fails immediately or after a short delay with:
```text
Connection dropped (ECONNRESET)
```
8. Claude retries the request repeatedly and eventually reports a connection error.
9. Repeat the same test in a different project or using a mobile hotspot. The issue remains reproducible.

### Claude Model

Opus

### Is this a regression?

Yes, this worked in a previous version

### Last Working Version

_No response_

### Claude Code Version

2.1.268 (Claude Code)

### Platform

Anthropic API

### Operating System

macOS

### Terminal/Shell

Terminal.app (macOS)

### Additional Information

_No response_

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Start by reproducing through the `claude --debug --debug-file` PowerShell entry point and inspect the debug log around bootstrap, policy checks, MCP registry, CCR/SSE streaming, and `/v1/messages`. Done means the first prompt completes reliably on Windows without ECONNRESET, socket hang-up, or certificate-verification errors, while retries remain limited to genuine transient failures.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
node.js
Lĩnh vực
api, cli, networking, operating-systems
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
32/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.