[BUG] `--resume` session picker leaves FSWatcher handles open, preventing Ctrl+D exit

Resolved 💬 4 comments Opened Jan 18, 2026 by tethiro Closed Feb 27, 2026

Bug Description

After using claude --resume with the interactive session picker, pressing Ctrl+D twice does not exit Claude Code. The process hangs and requires Ctrl+C to terminate.

Root Cause

9 FSWatcher handles remain active after the session picker closes, preventing the Node.js event loop from exiting on EOF (Ctrl+D).

> process._getActiveHandles().filter(h => h.constructor?.name === 'FSWatcher')
[ FSWatcher, FSWatcher, FSWatcher, FSWatcher, FSWatcher, FSWatcher, FSWatcher, FSWatcher, FSWatcher ]

Reproduction Steps

  1. Start a new Claude Code session: claude
  2. Send any message, then exit (Ctrl+D works fine)
  3. Resume with session picker: claude --resume
  4. Select a session from the picker
  5. Press Ctrl+D twice
  6. Expected: Claude Code exits
  7. Actual: Process hangs, no response. Only Ctrl+C terminates it.

Working Scenarios

| Command | Ctrl+D Exit |
|---------|-------------|
| claude (new session) | ✓ Works |
| claude --continue | ✓ Works |
| claude --resume <session-id> | ✓ Works |
| claude --resume (picker UI) | ✗ Hangs |

Debug Log Analysis

When the issue occurs, debug logs show:

  • Startup and plugin initialization complete
  • No [REPL:mount] entry after session picker selection
  • No keyboard/input events logged
  • Process stuck between picker close and REPL mount

Normal session shows:

[keybindings] KeybindingSetup initialized
[REPL:mount] REPL mounted, disabled=false
...
[REPL:unmount] REPL unmounting

Hanging session shows only startup logs, then silence.

Environment

  • OS: Windows 11 (cmd/Git Bash), macOS, WSL2 Ubuntu 24.04
  • Claude Code versions: 2.1.9, 2.1.10, 2.1.11, 2.1.12 (all affected)
  • Node.js versions: v20.x, v22.20.0 (all affected)
  • Fresh install: Issue reproduces on fresh Claude Code installation

Workarounds

  • Use /exit command instead of Ctrl+D
  • Use claude --continue instead of --resume
  • Specify session ID directly: claude --resume <session-id>

Related Issues

  • #15210 - FSWatcher file descriptor leak (similar FSWatcher cleanup issue)

View original on GitHub ↗

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