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.
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.
- 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.
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.