[BUG] Frequent UND_ERR_SOCKET connection failures during active sessions

Resolved 💬 4 comments Opened Mar 23, 2026 by tkail13 Closed May 12, 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?

During active Claude Code CLI sessions, the connection to the Anthropic API drops with Unable to connect to API (UND_ERR_SOCKET) errors. This happens mid-task (reading files, running bash commands) — not at session start. Auto-retry kicks in (up to 10 attempts) and usually recovers, but adds significant delays (30-60+ seconds per occurrence). Multiple occurrences per session today (March 23, 2026). Local internet is stable — other tools and services work fine during the failures.

What Should Happen?

API connections should remain stable during active sessions without dropping mid-task.

Error Messages/Logs

Unable to connect to API (UND_ERR_SOCKET)
Retrying in 2 seconds… (attempt 5/10)

Steps to Reproduce

  1. Start a Claude Code CLI session
  2. Give it a multi-step task that involves reading files and running bash commands
  3. Mid-task, the connection drops with UND_ERR_SOCKET
  4. Auto-retry attempts 1-10, usually recovers after several attempts
  5. Not reproducible on demand — happens intermittently throughout the session

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

Screenshot 2026-03-23 at 2.32.11 PM

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

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