[BUG] CLI deadlocks in Bun os_unfair_lock on macOS ARM64 (main thread + file watcher permanently blocked)
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 becomes completely unresponsive — no keyboard input works, no Ctrl+C, no output. The process stays alive but never recovers. Only option is kill. This has happened to me twice now.
Running sample against the frozen process reveals a permanent deadlock in the Bun runtime: the main thread is blocked trying to acquire an os_unfair_lock that will never be released.
Environment
- Claude Code: v2.1.69 (native binary)
- OS: macOS 15.7.4, ARM64 (Apple Silicon)
- Terminal: iTerm2, zsh
- MCP servers active: Codex, Playwright
Root Cause — os_unfair_lock deadlock in Bun runtime
I ran sample <pid> 3 against the frozen process. 100% of 2482 samples over 3 seconds show the same blocked state — zero progress.
Thread summary (15 threads):
| Thread | State | Blocked on |
|---|---|---|
| Main thread | Stuck | _os_unfair_lock_lock_slow → __ulock_wait2 |
| File Watcher | Stuck | _os_unfair_lock_lock_slow → __ulock_wait2 |
| Bun Pool 0–9 (10 threads) | Starved | __ulock_wait2 (waiting for work main thread will never dispatch) |
| HTTP Client | Normal idle | kevent64 |
| CFRunLoop | Normal idle | mach_msg2_trap |
| GCD worker | Normal idle | __workq_kernreturn |
No thread is running while holding the lock — the lock owner either crashed/exited while holding it, or the main thread is self-deadlocking (re-entering a non-recursive os_unfair_lock). Since os_unfair_lock has no timeout, waiters block forever.
Full sample output (no PII — only memory addresses, system library paths, and thread names):
https://gist.github.com/mykmelez/5134946e6885b6967f4ccf66c9a51975
What Should Happen?
The CLI should remain responsive. If an internal lock contention issue occurs, it should be detected and recovered from rather than deadlocking permanently.
Steps to Reproduce
Unknown exact trigger. Happened twice during normal interactive usage with Codex and Playwright MCP servers active. No obvious pattern — the CLI simply stops responding at some point.
Related Issues
- #12014 — grab-bag of CLI freeze reports with similar symptoms (unresponsive terminal, must kill). May share the same root cause in some cases, but that issue lacks diagnostic evidence.
- #10481 — similar freeze symptom on older Node-based Claude Code, but different root cause (
ReadFileUtf8I/O block vs. Bun runtime lock deadlock).
Claude Model
Opus 4.6
Is this a regression?
I don't know for certain, but I've experienced it twice in the last week or so, and I've been using Claude Code for months, so it does seem like a recent regression.
Claude Code Version
2.1.69
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
This issue was drafted by Claude Code (Opus 4.6) after diagnosing the frozen process; I'm posting it as-is.
This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗