[BUG] Session freezes completely during SSH/Bash commands - UI becomes unresponsive
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?
Claude Code CLI sessions intermittently freeze completely when executing SSH commands to remote servers.
During the freeze:
- The spinner animation stops completely (e.g., "Embellishing..." text freezes)
- Keyboard input is not accepted (Escape, Ctrl+C have no effect)
- The entire TUI becomes unresponsive
- The session recovers on its own after ~7 minutes
What Should Happen?
- The session should remain responsive during command execution
- If a pre-flight check is slow, it should not block the UI/input handling
- Keyboard interrupts (Escape) should work to cancel operations
Error Messages/Logs
Debug Log Findings
From ~/.claude/debug/f557c072-fd8e-4587-a647-c519a0efbb2f.txt:
1. BashTool Pre-flight Check Timeout (likely root cause)
2026-02-03T05:56:34.566Z [ERROR] Error: Error: console.error: ⚠️ [BashTool] Pre-flight check is taking longer than expected. Run with ANTHROPIC_LOG=debug to check for failed or slow API requests.
at Timeout._onTimeout (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:4799:7138)
There's a 7+ minute gap in the debug log (05:49:01 → 05:56:34) during which nothing was logged - this corresponds to the freeze duration.
2. Repeated "Bun is not defined" Errors (17 occurrences)
2026-02-03T05:48:33.478Z [ERROR] ReferenceError: ReferenceError: Bun is not defined
at Z34 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1602:27809)
at f34 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1614:83)
at C5q (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:4787:6330)
Process Analysis During Freeze
Using sample on the frozen process (PID 80360):
- Process state: S+ (sleeping, foreground)
- 97% of samples in kevent (waiting for I/O in event loop)
- Event loop IS running, but UI not responding to input
- Terminal in raw mode with -isig (signals disabled, as expected for TUI)
- No child SSH process remained (command had completed)
- No active TCP connections to the process
Steps to Reproduce
- Start a Claude Code session
- Have Claude execute multiple SSH commands to a remote server in sequence
- Example command that triggered freeze:
ssh constellation 'cat ~/constellation/docs/decisions/ADR-001.md 2>/dev/null || find ~/constellation -name "ADR-001" -type f 2>/dev/null'
- Session freezes mid-execution
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.29
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
Additional Context
- The Bun is not defined error suggests there's Bun-specific code being called in a Node.js environment
- Issue occurs specifically during SSH commands to remote servers
- Not every SSH command triggers the freeze (intermittent)
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗