[BUG]

Resolved 💬 5 comments Opened Dec 27, 2025 by hn-alchemist Closed Feb 14, 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?

Connection drops after idle period, cannot reconnect without force kill
Description:
Claude Code loses API connection after being idle for a period of time and fails to reconnect automatically. The session becomes completely unresponsive and cannot be recovered without force killing the process.
Environment:

Claude Code version: 2.0.76
OS: macOS (tested on multiple Macs)
Installation method: Both native installer and npm (@anthropic-ai/claude-code)
Network: Stable — curl -v https://api.anthropic.com works fine during the issue

Steps to reproduce:

Start Claude Code and work normally
Leave session idle for 15-30+ minutes
Return and try to send a message

Expected behaviour:
Session reconnects automatically or prompts for re-authentication.
Actual behaviour:

Errors: ECONNRESET, ENOTCONN, Unable to connect to API
Retry attempts fail (shows "attempt 4/10", "attempt 9/10" etc.)
Ctrl+C does not work to exit
ESC does not interrupt
Only fix is pkill -9 -f claude from another terminal

Additional context:

Using /logout makes the problem worse — cannot reconnect at all afterward
The issue severely disrupts workflow as project context is lost
Node.js can connect fine: node -e "fetch('https://api.anthropic.com').then(r => console.log(r.status))" returns 404 as expected

Impact:
Cannot reliably use Claude Code for any extended work session.

What Should Happen?

What Should Happen:

Claude Code should maintain connection during idle periods or gracefully reconnect when activity resumes
If connection is lost, automatic retry should actually succeed (not fail repeatedly)
Ctrl+C and ESC should always work to exit the session, even during connection errors
Session should never get into an unrecoverable state requiring force kill
If re-authentication is needed, Claude Code should prompt for it cleanly instead of hanging

Error Messages/Logs

Steps to Reproduce

Steps to Reproduce:

Open terminal and run claude
Authenticate and start a conversation
Work normally for a few minutes (send a few messages)
Leave the session idle for 15-30 minutes (don't close terminal, just step away)
Return and type any message, press Enter
Observe connection error: Unable to connect to API (ECONNRESET) or ENOTCONN
Wait for retry attempts — all 10 attempts fail
Try pressing Ctrl+C — does not exit
Try pressing ESC — does not interrupt
Only way to recover: open new terminal and run pkill -9 -f claude

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

Claude Code v2.0.76

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

IntelliJ IDEA terminal

Additional Information

_No response_

View original on GitHub ↗

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