[BUG] /mcp reconnect causes deadlock when MCP server not configured
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?
Running /mcp reconnect playwright when the MCP server is not configured causes Claude Code to immediately deadlock. The session shows the error message "MCP server 'playwright' not found" but then freezes completely - no input accepted, no response to Escape or any keys. The process remains frozen indefinitely and must be force-killed.
Technical details:
- Main thread stuck in
kevent()waiting for I/O that never arrives - Open pipe file descriptors (13, 14) but no child process spawned
- Debug log shows command was never processed - log ends at initialization
- Stack trace shows:
uv__io_poll -> kevent(blocked in event loop)
What Should Happen?
After showing the error "MCP server not found", Claude Code should:
- Return to normal prompt
- Remain responsive and usable
- Allow user to continue working or fix configuration
- Clean up any resources (close pipes)
- Not attempt to connect to non-existent server
Error Messages/Logs
Terminal output:
✘ Failed to reconnect to playwright
Error: MCP server "playwright" not found
Debug log (6c752d67-d15d-4ae1-b12b-723ab852f4eb.txt):
Last entries before hang:
[DEBUG] Getting matching hook commands for SubagentStop with query: undefined
[DEBUG] AutoUpdaterWrapper: Installation type: npm-global
(Log ends here - no mention of "mcp", "reconnect", or "playwright")
Stack trace from 'sample 48811 5':
Main thread: uv__io_poll (in libuv.1.0.0.dylib) + 724
kevent (in libsystem_kernel.dylib) + 8
Process state:
lsof -p 48811 | grep PIPE:
node 48811 sandman 13 PIPE 0xac44d11643cbe7d8 16384 ->0x301027970e85d0dd
node 48811 sandman 14 PIPE 0x301027970e85d0dd 16384 ->0xac44d11643cbe7d8
ps -o pid,ppid,command | awk '$2 == 48811':
(no output - no child processes)
Steps to Reproduce
- Navigate to a project directory where Playwright MCP is NOT configured:
cd ~/Documents/code/create/project1
- Start Claude Code:
claude code
- Wait for initialization to complete (respond to trust prompt if shown)
- Execute command:
/mcp reconnect playwright
- Observe: Error message appears, then session immediately freezes
- Verify freeze: Try typing, pressing Escape, Ctrl+C - nothing responds
- Confirm: Process stuck indefinitely (waited 10+ minutes)
Reproducibility: 100% - happens every time in projects without MCP configured
Claude Model
hanging_session_log.txt
lsof_pipes.txt
process_list.txt
reproduction_steps.txt
stack_trace.txt
system_info.txt
working_session_log.txt
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.0.36 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
Attached files:
- hanging_session_log.txt - Complete debug log from frozen session (PID 48811)
- stack_trace.txt - Full stack trace from sample command
- working_session_log.txt - Comparison log from successful session with MCP configured
- system_info.txt - Full environment details (Node v24.9.0, macOS versions)
- Screenshot showing frozen terminal state
Key findings:
- Bug only occurs when MCP server is NOT configured
- Same command works fine when MCP server IS properly configured
- No timeout mechanism exists - hangs indefinitely
- Event loop deadlock - main thread blocked in kevent()
- Pipes opened but child process never spawned
Impact: Medium severity - complete loss of session, no recovery possible. Workarounds are available, but will lose the current claude session/context.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗