[BUG] Claude Code connection error on macOS (Max Plan) - Linux works fine on same IP

Resolved 💬 2 comments Opened Jun 20, 2026 by nk9453 Closed Jun 23, 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?

Description:

Claude Code cannot connect to the API on macOS, but the same network/IP works fine on Linux. Max Plan subscriber.

Environment:

  • macOS version:
ProductName:		macOS
ProductVersion:		26.5.1
BuildVersion:		25F80
  • Claude Code version:

2.1.183 (Claude Code)
Issue:

  • Repeated "API error: undefined Connection error" when trying to use Claude Code
  • Retried with /login - no change
  • No HTTP proxy configured
  • Cleared all macOS proxy settings (networksetup)
  • Reinstalled Claude Code - still fails

Diagnostics:

  • curl -v https://api.anthropic.com/v1/messagesSuccess (HTTP 405, connection works)
  • nslookup api.anthropic.comSuccess (resolves to 160.79.104.10)
  • Same IP on Linux machine → Works fine
  • /feedback command also fails to send

Debug log:

**Debug Log (Sanitized):**

2026-06-20T03:34:19.230Z [DEBUG] CA certs: stores=bundled,system, extraCertsPath=undefined
2026-06-20T03:34:19.232Z [DEBUG] CA certs: Loaded 145 bundled root certificates
2026-06-20T03:34:19.252Z [DEBUG] CA certs: system store returned empty
2026-06-20T03:34:19.252Z [DEBUG] mTLS: Creating HTTPS agent with custom certificates

2026-06-20T03:34:19.268Z [DEBUG] Acquired PID lock for 2.1.183 (PID 43085)
2026-06-20T03:34:19.287Z [DEBUG] Loaded 1 unique skills (1 unconditional, 0 conditional, managed: 0, user: 1, project: 0, additional: 0, legacy commands: 0)
2026-06-20T03:34:19.290Z [DEBUG] Found 3 plugins (3 enabled, 0 disabled)
2026-06-20T03:34:19.299Z [DEBUG] Total plugin skills loaded: 15 (0 duplicate/user-owned entries skipped)

2026-06-20T03:34:19.323Z [DEBUG] Cleared CA certificates cache
2026-06-20T03:34:19.323Z [DEBUG] Cleared mTLS configuration cache
2026-06-20T03:34:19.324Z [DEBUG] Cleared proxy agent cache
2026-06-20T03:34:19.324Z [DEBUG] CA certs: stores=bundled,system, extraCertsPath=undefined
2026-06-20T03:34:19.324Z [DEBUG] CA certs: Loaded 145 bundled root certificates
2026-06-20T03:34:19.324Z [DEBUG] CA certs: system store returned empty
2026-06-20T03:34:19.324Z [DEBUG] mTLS: Creating HTTPS agent with custom certificates

2026-06-20T03:34:19.404Z [DEBUG] [API:auth] OAuth token check complete
2026-06-20T03:34:19.406Z [DEBUG] [API REQUEST] /v1/messages x-client-request-id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx source=quota_check

2026-06-20T03:34:22.435Z [DEBUG] [API:auth] OAuth token check complete
2026-06-20T03:34:22.436Z [DEBUG] [API:timing] dispatching to firstParty model=claude-opus-4-8[1m]
2026-06-20T03:34:22.436Z [DEBUG] [API REQUEST] /v1/messages x-client-request-id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx source=repl_main_thread
2026-06-20T03:34:22.440Z [DEBUG] Fast mode unavailable: Fast mode requires usage credits · /usage-credits to turn them on

2026-06-20T03:34:22.464Z [ERROR] API error (attempt 1/11): undefined Connection error.
2026-06-20T03:34:23.038Z [ERROR] API error (attempt 2/11): undefined Connection error.
2026-06-20T03:34:24.144Z [ERROR] API error (attempt 3/11): undefined Connection error.
2026-06-20T03:34:26.395Z [ERROR] API error (attempt 4/11): undefined Connection error.

2026-06-20T03:34:29.318Z [ERROR] 1P event logging: 166 events failed to export (code=ECONNRESET, The socket connection was closed unexpectedly.)
2026-06-20T03:34:29.318Z [ERROR] [3P telemetry] OTEL diag error: Failed to export 166 events (code=ECONNRESET)

2026-06-20T03:34:31.108Z [ERROR] Error in API request: Request was aborted.

What Should Happen?

Claude Code should connect to the API and work normally, as it does on Linux with the same network connection.

Error Messages/Logs

**API Connection Errors (repeated 4+ times):**
2026-06-20T03:34:22.464Z [ERROR] API error (attempt 1/11): undefined Connection error.
2026-06-20T03:34:23.038Z [ERROR] API error (attempt 2/11): undefined Connection error.
2026-06-20T03:34:24.144Z [ERROR] API error (attempt 3/11): undefined Connection error.
2026-06-20T03:34:26.395Z [ERROR] API error (attempt 4/11): undefined Connection error.

**Telemetry Export Failures:**
2026-06-20T03:34:29.318Z [ERROR] 1P event logging: 166 events failed to export (code=ECONNRESET, The socket connection was closed unexpectedly.)
2026-06-20T03:34:29.318Z [ERROR] [3P telemetry] OTEL diag error: Failed to export 166 events (code=ECONNRESET)

**Request Abort:**
2026-06-20T03:34:31.108Z [ERROR] Error in API request: Request was aborted.

Steps to Reproduce

  1. Run claude on macOS 2.1.183
  2. Send any prompt
  3. Observe: "API error: undefined Connection error" (repeats 4+ times)

Note: Same network/IP works fine on Linux machine

Claude Model

None

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.183 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

iTerm2

Additional Information

Claude Code worked fine on this macOS machine yesterday. The issue started recently without any configuration changes. Same network/IP works fine on Linux. Curl can connect to the API successfully, so the network itself is fine.

View original on GitHub ↗

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