You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Segmentation Fault on commands like "bun i" and "bun upgrade" when Carbon Black AV Active on Windows #10056
Install bun and run command line utilities like "bun install", "bun upgrade" etc in a corporate laptop with Windows, Getting segmentation fault and other errors on the first command run, 2nd time onwards the command seems to work fine.
below is one example. Carbon Black AV dll seems to be the culprit here, Same errors happens with bun install too.
No problems faced with NPM, maybe make bun executable white listed with major AV vendors?
bun upgrade
PS C:\Work\Angular Study\DynamicHeader> bun upgrade
Bun v1.1.2 is out! You're on 1.1.1
Segmentation fault at address 0xdc2d01e010
???:?:?: 0x7ffada7fda29 in ??? (ctiuser.dll)
???:?:?: 0x7ffb2bc0dd62 in ??? (KERNELBASE.dll)
???:?:?: 0x7ffb2de9d38b in ??? (KERNEL32.DLL)
???:?:?: 0x7ff77b568f7d in ??? (bun.exe)
???:?:?: 0x7ff77b56a4b4 in ??? (bun.exe)
???:?:?: 0x7ff77b45bbbe in ??? (bun.exe)
???:?:?: 0x7ff77b58ac0d in ??? (bun.exe)
???:?:?: 0x7ff77b58c406 in ??? (bun.exe)
???:?:?: 0x7ff77b5990e7 in ??? (bun.exe)
???:?:?: 0x7ff77b2c1603 in ??? (bun.exe)
???:?:?: 0x7ff77de43ec3 in ??? (bun.exe)
???:?:?: 0x7ffb2de97343 in ??? (KERNEL32.DLL)
???:?:?: 0x7ffb2e1a26b0 in ??? (ntdll.dll)
PS C:\Work\Angular Study\DynamicHeader> bun upgrade
Congrats! You're already on the latest version of Bun (which is v1.1.2)
PS C:\Work\Angular Study\DynamicHeader>
Bun i
Laptop has AV tools like Symantec Endpoint security,Carbon Black,Rapid 7 etc installed.
What is the expected behavior?
I expected bun to install the project dependencies without crashing, regardless of the antivirus software running in the background.
What do you see instead?
Segmentation fault error on first try
Additional information
Installed AV tools
Symantec Endpoint Protection
Carbon Black
Rapid 7
Netskope
changed the title [-]Segmentation Fault on commands like "bun i" and "bun upgrade" - When Executing Bun Commands with AV Software Active[/-][+]Segmentation Fault on commands like "bun i" and "bun upgrade" - When Executing Bun Commands with AV Software Active on Windows[/+]on Apr 8, 2024
changed the title [-]Segmentation Fault on commands like "bun i" and "bun upgrade" - When Executing Bun Commands with AV Software Active on Windows[/-][+]Segmentation Fault on commands like "bun i" and "bun upgrade" - When Executing Bun Commands with AV Software Active on Windows[/+]on Apr 8, 2024
changed the title [-]Segmentation Fault on commands like "bun i" and "bun upgrade" - When Executing Bun Commands with AV Software Active on Windows[/-][+]Segmentation Fault on commands like "bun i" and "bun upgrade" when Carbon Black AV Active on Windows[/+]on Oct 10, 2025
For anyone reading this, it was fixed at my (work) laptop by adding a bypass rule in carbon black for these folders.
c:\users*.bun\bin\bun.exe
c:\users*.bun\bin\bun-windows-x64\bun.exe
TL;DR: these segfaults happen inside third-party endpoint-security hooks that intercept CreateProcessW — Carbon Black App Control's ctiuser.dll in most decoded reports, BeyondTrust Privilege Guard's PGHook.dll in some — not in Bun's own spawn code. Adding a Carbon Black approval/bypass rule for bun.exe (as confirmed in an earlier comment here) makes them disappear.
What the stacks show
Every decodable report in this family has the same sandwich:
??? in ctiuser.dll ← crash PC
??? in ctiuser.dll
??? in KERNEL32.DLL
??? in KERNELBASE.dll ← the real CreateProcessInternalW
??? in KERNELBASE.dll
??? in KERNEL32.DLL
??? in ctiuser.dll ← hook entry
uv_spawn vendor libuv src/win/process.c:1067
spawn libuv.zig
spawnProcess process.zig
process.c:1067 at the libuv revision pinned by bun 1.3.x is exactly the CreateProcessW(...) call inside uv_spawn. The frames above it are the security product's in-process hook wrapping that call, re-entering the real API, getting called back, and crashing on its own state — at 0x113 (near-null) in several reports, or at page-aligned heap addresses (e.g. 0xdc2d01e010 in this issue's original report) when its scanner reads past a committed heap region. In the Sentry events where these frames show only as <anonymous>, the PCs sit in module-less executable memory — hook trampolines — which is why they can't be attributed to any DLL at all.
The "first command crashes, second run works" behavior reported above also matches Carbon Black App Control's first-execution analysis of not-yet-cached binaries, and explains why this appears as a steady background rate across Bun versions (1.3.10 → 1.3.14 equally affected) rather than a regression.
Why it isn't a Bun argument/env bug
To rule out Bun's side, every input handed to uv_spawn/CreateProcessW was audited across the spawn paths (Bun.spawn/spawnSync, node:child_process, the shell, bun install lifecycle scripts, bun run, bunx), on both the 1.3.x implementation and current main:
argv is always non-empty and NULL-sentinel-terminated; arg/env strings are NUL-terminated copies, with embedded NUL bytes rejected up front.
The env array gets its NULL sentinel appended before every spawn; inherited env comes from a sentinel-allocated map.
cwd and file/argv0 are explicitly NUL-terminated.
libuv's make_program_args / make_program_env / uv__stdio_create size-then-copy consistently, so the lpCommandLine / lpEnvironment / lpApplicationName / lpReserved2 buffers passed to CreateProcessW are well-formed given those inputs.
Bun 1.3.11–1.3.13 pinned unpatched upstream libuv (f3ce527e) and crash at the same rate as 1.3.14 (which added the ConPTY patch), so Bun's libuv fork changes are not a factor either.
Workarounds
Carbon Black App Control (ctiuser.dll): have IT add an approval/bypass rule for bun.exe (and Bun-managed cache directories, e.g. %TEMP%\bunx-*, the install cache) — confirmed fix in this thread.
BeyondTrust Privilege Management (PGHook.dll): add an application exclusion for bun.exe.
Publishers bundling Bun (e.g. standalone executables) hit the same hooks; the exclusion needs to cover the bundled binary.
Two unrelated, currently-unreachable libuv edge cases turned up during the audit (upstream already fixed the empty-argv command-line termination in libuv/libuv@e8575ba — worth picking up on the next fork rebase). Neither is reachable from Bun's spawn paths and neither explains this crash family.
Bun's Vectored Exception Handler no longer intercepts first-chance access violations raised outside bun.exe's own image, so SEH-guarded probes from injected DLLs (AV/EDR hooks, sandboxing, virtualization guest tools) reach their __except handler instead of being reported as a Bun crash.
Verified the mechanism on Windows x64 canary 1.4.0-canary.1+50bb3bd8e:
$ bun -e "require('bun:ffi').dlopen('kernel32.dll',{IsBadReadPtr:{args:['usize','usize'],returns:'i32'}}).symbols.IsBadReadPtr(0xE8,8); console.log('PASS: no crash')"
PASS: no crash
(Before #35083 this reported panic: Segmentation fault at address 0xE8.)
If this still reproduces on a canary newer than 50bb3bd with the specific software installed, please reopen with the crash report link.
Activity
[-]Segmentation Fault on commands like "bun i" and "bun upgrade" - When Executing Bun Commands with AV Software Active[/-][+]Segmentation Fault on commands like "bun i" and "bun upgrade" - When Executing Bun Commands with AV Software Active on Windows[/+][-]Segmentation Fault on commands like "bun i" and "bun upgrade" - When Executing Bun Commands with AV Software Active on Windows[/-][+]Segmentation Fault on commands like "bun i" and "bun upgrade" - When Executing Bun Commands with AV Software Active on Windows[/+]github-actions commentedon Aug 8, 2024
This issue is stale and may be closed due to inactivity. If you're still running into this, please leave a comment.
[-]Segmentation Fault on commands like "bun i" and "bun upgrade" - When Executing Bun Commands with AV Software Active on Windows[/-][+]Segmentation Fault on commands like "bun i" and "bun upgrade" when Carbon Black AV Active on Windows[/+]jboyesreach00 commentedon Oct 23, 2025
still happening in 1.3.1
I thought the windows file signing was supposed to fix it?
Bun v1.3.1 (
89fa0f3) on windows x86_64 [InstallCommand]Segmentation fault at address 0x8AEDE6B010
0x75e60in ctiuser.dll0x74814in ctiuser.dll0x78313in KERNELBASE.dll0x1d3bcin KERNEL32.DLLprocess.c:843:uv__process_proc_exitcore.c:618:uv__process_reqscore.c:736:uv_runMiniEventLoop.zig:197:tickatomic.zig:16:loadinstall_command.zig:80:installWithCLIinstall_command.zig:55:installcli.zig:20:startmain.zig:62:mainexe_common.inl:78:invoke_mainFeatures: tsconfig, tsconfig_paths, binlinks, bunfig, lifecycle_scripts, text_lockfile, hoisted_bun_install, spawn
Sentry Issue: BUN-ZJD
Casenl commentedon Feb 5, 2026
For anyone reading this, it was fixed at my (work) laptop by adding a bypass rule in carbon black for these folders.
c:\users*.bun\bin\bun.exe
c:\users*.bun\bin\bun-windows-x64\bun.exe
robobun commentedon Jun 4, 2026
Root-cause analysis for the Windows
uv_spawncrash family (Sentry groups BUN-2V2M — ~9,500 events — and BUN-Y5X; also #21693, #22344, #22930, #23460, #24260, #24828, #25153, #25299)TL;DR: these segfaults happen inside third-party endpoint-security hooks that intercept
CreateProcessW— Carbon Black App Control'sctiuser.dllin most decoded reports, BeyondTrust Privilege Guard'sPGHook.dllin some — not in Bun's own spawn code. Adding a Carbon Black approval/bypass rule forbun.exe(as confirmed in an earlier comment here) makes them disappear.What the stacks show
Every decodable report in this family has the same sandwich:
process.c:1067at the libuv revision pinned by bun 1.3.x is exactly theCreateProcessW(...)call insideuv_spawn. The frames above it are the security product's in-process hook wrapping that call, re-entering the real API, getting called back, and crashing on its own state — at0x113(near-null) in several reports, or at page-aligned heap addresses (e.g.0xdc2d01e010in this issue's original report) when its scanner reads past a committed heap region. In the Sentry events where these frames show only as<anonymous>, the PCs sit in module-less executable memory — hook trampolines — which is why they can't be attributed to any DLL at all.The "first command crashes, second run works" behavior reported above also matches Carbon Black App Control's first-execution analysis of not-yet-cached binaries, and explains why this appears as a steady background rate across Bun versions (1.3.10 → 1.3.14 equally affected) rather than a regression.
Why it isn't a Bun argument/env bug
To rule out Bun's side, every input handed to
uv_spawn/CreateProcessWwas audited across the spawn paths (Bun.spawn/spawnSync,node:child_process, the shell,bun installlifecycle scripts,bun run,bunx), on both the 1.3.x implementation and current main:argvis always non-empty and NULL-sentinel-terminated; arg/env strings are NUL-terminated copies, with embedded NUL bytes rejected up front.cwdandfile/argv0are explicitly NUL-terminated.make_program_args/make_program_env/uv__stdio_createsize-then-copy consistently, so thelpCommandLine/lpEnvironment/lpApplicationName/lpReserved2buffers passed toCreateProcessWare well-formed given those inputs.f3ce527e) and crash at the same rate as 1.3.14 (which added the ConPTY patch), so Bun's libuv fork changes are not a factor either.Workarounds
bun.exe(and Bun-managed cache directories, e.g.%TEMP%\bunx-*, the install cache) — confirmed fix in this thread.bun.exe.Two unrelated, currently-unreachable libuv edge cases turned up during the audit (upstream already fixed the empty-
argvcommand-line termination in libuv/libuv@e8575ba — worth picking up on the next fork rebase). Neither is reachable from Bun's spawn paths and neither explains this crash family.crash_handler(windows): let external-DLL first-chance exceptions reac…
crash_handler(windows): let SEH-guarded first-chance faults in extern…
crash_handler(windows): let foreign first-chance AVs reach SEH via JS…
robobun commentedon Jul 24, 2026
Fixed by #35083.
Bun's Vectored Exception Handler no longer intercepts first-chance access violations raised outside
bun.exe's own image, so SEH-guarded probes from injected DLLs (AV/EDR hooks, sandboxing, virtualization guest tools) reach their__excepthandler instead of being reported as a Bun crash.Verified the mechanism on Windows x64 canary 1.4.0-canary.1+50bb3bd8e:
(Before #35083 this reported
panic: Segmentation fault at address 0xE8.)If this still reproduces on a canary newer than 50bb3bd with the specific software installed, please reopen with the crash report link.
ci: close issues and PRs linked from merged PR descriptions (#40064)