Claude Desktop: EventEmitter memory leak causes ECONNRESET after running multiple Code sessions

Open 💬 1 comment Opened Jun 7, 2026 by sgartland4304

Summary

Running 3+ Claude Code sessions concurrently in Claude Desktop (Mac) causes all sessions to fail with API Error: Unable to connect to API (ECONNRESET) after 10 retries. The root cause appears to be an EventEmitter memory leak in the Desktop app's IPC bus, not an API-side or rate-limit issue.

Environment

  • Claude Desktop v1.11187.4 (macOS, Apple Silicon)
  • Claude Code v2.1.165
  • Model: claude-opus-4-8[1m]
  • Plan: Max 20x (not a rate limit issue)
  • macOS Darwin 25.3.0

Repro Steps

  1. Open Claude Desktop
  2. Start 3 Claude Code sessions (each spawns MCP servers: GitHub, Firecrawl, Pencil)
  3. Work in all 3 sessions for a few minutes
  4. All sessions begin failing with: API Error: Unable to connect to API (ECONNRESET) — retries 10 times then gives up
  5. Starting new sessions also fails until the app is restarted

Evidence

The API is reachable throughout (confirmed via curl):

$ curl -s -o /dev/null -w "HTTP %{http_code} | %{time_total}s" https://api.anthropic.com/v1/messages -X POST -H "content-type: application/json" -d '{}'
HTTP 401 | 0.155763s

~/Library/Logs/Claude/claude.ai-web.log shows:

MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 $eipc_message$_..._$_claude.settings_$_AppPreferences_$_preferencesChanged listeners added.

MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 $eipc_message$_..._$_claude.web_$_AutoUpdater_$_updaterState_$store$_update listeners added.

[error] [REACT_QUERY_CLIENT] QueryClient error: {"diagnostics":{"url":"https://api.anthropic.com/mcp-registry/v0/servers?version=latest&limit=100","onLine":true,"readyState":"complete","visibilityState":"visible",...},"name":"RegistryFetchError","cause":{"name":"TypeError","message":"Failed to fetch",...}}

The pattern:

  • Each Code session spawn/close leaks listeners on preferencesChanged and AutoUpdater IPC channels
  • Listener count grows past the default 10 limit (warning fires at 11)
  • Eventually the Electron process's event loop is overwhelmed
  • Outbound HTTP connections start getting reset (ECONNRESET)
  • Even the MCP registry fetch fails with TypeError: Failed to fetch

Workaround

killall Claude && open -a Claude — restarting the app clears the leaked listeners and sessions work again until the leak re-accumulates.

Additional context

  • Also observed: the app continuously polls 4 deleted server-side sessions (/v1/code/sessions/.../mark_read returning 404) every ~5 minutes, which may accelerate the leak
  • Having many git worktrees (73 in my case) with associated MCP server processes compounds the issue, but the leak occurs even after cleaning those up
  • The [MCP] [AutoSyncConnectorsToSession] Failed to sync remote servers error (Query closed before response received) appears correlated with the degraded state

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗