[BUG] bug_report_claude_code_bun_crash_en
Status Open
Reported on v2.1.263
Maintainer reply None cached
Activity 2 comments · opened Sep 7, 2026
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 on terminal crashes with no replicable scenario
What Should Happen?
It should not crash
Error Messages/Logs
Bug Report — Recurring Segmentation Fault (Bun JIT / JITWorker) in Claude Code
Summary
Claude Code crashes reproducibly on two different environments (native Windows and WSL2/Ubuntu) with a segmentation fault in the embedded Bun runtime. The kernel crash log (dmesg, WSL2 side) precisely identifies a `JITWorker` thread (JavaScriptCore JIT) crashing with SIGSEGV right after a `futex` syscall — a signature consistent with a thread-synchronization race condition in Bun's JIT, not a user-environment issue.
Impact
Terminal window closes abruptly mid-task, with no warning
Reproducible both at launch (a few seconds after `claude`) and during a long session (observed after ~3 minutes)
Reproduced on two different Bun runtime builds: `v1.4.1 Windows x64` and `v1.4.1 Linux x64` (WSL2) — same version, two OSes, same crash signature
Environment
Claude Code version: 2.1.263
OS 1: Windows 11 Home, build 10.0.26200
OS 2: Ubuntu 26.04 LTS under WSL2 (kernel 6.18.33.2-microsoft-standard-WSL2)
Installation: npm global (`@anthropic-ai/claude-code`), also reproduced with the native Windows installer (`~/.local/bin/claude.exe`)
Project context: large Unity project (multi-MB assets), with a local MCP server actively communicating over HTTP/WebSocket on `127.0.0.1` (UnityMCP)
Machine RAM: 32 GB (memory usage at crash time well under any limit: RSS 0.25–0.32 GB)
Crash logs
Crash 1 — Native Windows, npm install, mid-session (~11.6 min)
============================================================
Bun v1.4.1 (83c373b27) Windows x64
Windows v10.26200
CPU: sse42 avx avx2
Args: "C:\Users\XXX\AppData\Roaming\npm\\node_modules\@anthropic-ai\claude-code\bin\claude.exe"
Features: Bun.stderr(2) Bun.stdin(2) Bun.stdout(2) abort_signal(152) fetch(331) jsc spawn(38) standalone_executable claude_code
Elapsed: 698521ms | User: 8187ms | Sys: 6015ms
RSS: 0.61 GB | Peak: 0.64 GB | Commit: 0.56 GB | Faults: 348905 | Machine: 34.0 GB
panic(main thread): Segmentation fault at address 0x38BF8200
oh no: Bun has crashed. This indicates a bug in Bun, not your code.
https://bun.report/1.4.1/w_183c373bmggggQuhogC____osyn8CqsmloC+6vs9B8q0n8C893yjC8xgyjC26mhoCi30p6Bmys42B__osyn8CqsmloCwv+kjCmv9xkBshl31BA2Aggh+34B
Crash 2 — WSL2/Ubuntu, at startup (~6–8s after launch, x2 occurrences)
============================================================
Bun v1.4.1 (83c373b27) Linux x64
WSL Kernel v6.18.33 | glibc v2.43
CPU: sse42 popcnt avx avx2
Args: "claude"
Elapsed: 8188ms | User: 869ms | Sys: 311ms
RSS: 0.32 GB | Peak: 0.32 GB | Commit: 0.64 GB | Faults: 0 | Machine: 16.60 GB
panic: Segmentation fault at address 0xC998
oh no: Bun has crashed. This indicates a bug in Bun, not your code.
https://bun.report/1.4.1/l_183c373bmggggQugogCu5kgnCo+lykEsmmykEsypolEss42kEu0s1kEy8kwlEy76pjE2isl/Dw8jjtEwk3ytEm31kpE6tt90Dwh211Dytgpb267tCA2Aw5kD
Crash 3 — WSL2/Ubuntu, long session (~3 min)
============================================================
Bun v1.4.1 (83c373b27) Linux x64
WSL Kernel v6.18.33 | glibc v2.43
CPU: sse42 popcnt avx avx2
Args: "claude"
Elapsed: 184017ms | User: 1866ms | Sys: 705ms
RSS: 0.25 GB | Peak: 0.30 GB | Commit: 0.75 GB | Faults: 66 | Machine: 16.60 GB
panic: Segmentation fault at address 0x0
oh no: Bun has crashed. This indicates a bug in Bun, not your code.
https://bun.report/1.4.1/l_183c373bmgggglugogC41sm6Ds4rm6Dwljm6Dylog8Du9597D6ks87D8s/k/Dw8jjtEwk3ytEm31kpE6tt90Dwh211Dytgpb267tCA2AA
Kernel diagnostic (dmesg, WSL2) — key finding
Kernel trace captured for the two startup crashes under WSL2, confirming the precise mechanism:
[15:58:13] claude.exe: JITWorker: potentially unexpected fatal signal 11.
PID 2225, CPU 17 — SIGSEGV in thread "JITWorker"
[15:59:18] claude.exe: JITWorker: potentially unexpected fatal signal 11.
PID 3434, CPU 28 — SIGSEGV in thread "JITWorker", same relative offset
Observations:
Signal 11 (SIGSEGV) consistently occurs in a thread named `JITWorker` (JavaScriptCore JIT, an internal Bun component)
Same relative code offset for both occurrences
The crash happens right after a `futex` syscall (`ORIG_RAX: 0xea`) — consistent with a thread-synchronization race condition during JIT initialization or compilation
Session timeline for that day:
Session A started 15:58:07 → crashed at 15:58:13 (~6s after launch)
Session B started 15:59:11 → crashed at 15:59:18 (~7s after launch)
Session C started 16:00:23 → survived startup (no crash at launch on this one, crash occurred later mid-session, see Crash 3)
This last observation suggests a timing/CPU-load-dependent vulnerability window at startup (likely a race condition), rather than a guaranteed 100%-reproducible crash — which would explain the "random" behavior reported by other users in similar GitHub issues (e.g. anthropics/claude-code#21469, #18049, #11294).
What was ruled out as a cause
Not an installation issue: reproduced with both the native Windows installer and the npm install
Not OS-specific: reproduced on native Windows 11 AND under WSL2/Ubuntu, with the same Bun v1.4.1
Not memory exhaustion: RSS between 0.25 and 0.64 GB on a 32–34 GB machine, nowhere near any limit
Not tied to a specific file or user action: occurs both on cold startup (`claude` with no command typed yet) and mid-session during active use
Hypothesis
Race condition in Bun's JIT (JavaScriptCore) around thread synchronization via futex, likely more easily triggered under variable CPU load (startup, or activity spikes mid-session). The fact that the same Bun version (1.4.1) crashes with a near-identical signature on two different platforms points to a bug in the JIT code itself rather than an OS-specific integration layer.
Suggestion
Given the recurrence of this crash type across multiple Bun versions (1.3.1, 1.3.5, 1.3.9, 1.3.10, 1.3.11, 1.4.1 — all sharing the same "Segmentation fault" + "This indicates a bug in Bun, not your code" signature), it may be worth evaluating a pure Node.js runtime fallback option for users experiencing repeated crashes, pending an upstream fix in Bun.
Steps to Reproduce
No real idea, sometimes I can not write the first prompt, sometimes I can work 5 minutes
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
2.1.263 minus one?
Claude Code Version
2.1.263
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗