Bun "Segmentation fault" on the runner in CI
Bun crashed with a segfault instead of exiting cleanly. In CI this usually means the Bun binary does not match the runner CPU baseline, or a native module Bun loaded is incompatible with this Bun version.
What this error means
A Bun step aborts with "Segmentation fault (core dumped)" or "Illegal instruction", often mid-bun install or on first bun run, and reproduces only on the runner.
Terminal
bun install
Segmentation fault (core dumped)
Error: Process completed with exit code 139.Common causes
A Bun build that needs a newer CPU baseline
The standard Bun release uses AVX2; on an older or emulated runner CPU it crashes with SIGSEGV or SIGILL.
A native addon incompatible with this Bun
A prebuilt N-API/native module built for a different ABI or Bun version can fault when Bun dlopens it.
How to fix it
Use the baseline Bun build on older CPUs
setup-bun can install the baseline variant that drops the newer CPU instruction requirement.
.github/workflows/ci.yml
- uses: oven-sh/setup-bun@v2
with:
bun-version: '1.1.34'
# baseline avoids AVX2 requirement on old/emulated CPUsReinstall native modules against this Bun
- Delete
node_modulesand the install cache so stale native builds are dropped. - Reinstall so addons are fetched or rebuilt for the runner ABI.
- Pin a Bun version known to work with the addon.
Terminal
rm -rf node_modules
bun installHow to prevent it
- Pin a Bun version validated against your native dependencies.
- Use the baseline Bun build on older or emulated runner CPUs.
- Avoid caching node_modules across different Bun versions.
Related guides
Bun "TypeError: X is not a function" (Node API gap) in CIFix Bun "TypeError: X is not a function" in CI - a Node.js API a dependency calls is not implemented (or diff…
Bun "node:X is not yet implemented in Bun" in CIFix Bun "node:X is not yet implemented in Bun" in CI - code imports a Node built-in module or feature Bun has…
Bun version mismatch (packageManager / bun --version) in CIFix Bun version mismatches in CI where the runner Bun differs from the one your lockfile or packageManager fi…