opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Since opencode 1.0.116 no longer able to run binary as it crashes with bun seg fault

Open kalvenschraut opened this issue 1 month ago • 9 comments

Question

1.0.115 I can run just fine, it only crashes if starting in a code repo on my machine see https://github.com/oven-sh/bun/issues/25276 where I reported the bug in bun, not sure what change would have caused this? https://github.com/sst/opencode/compare/v1.0.115...v1.0.116

kalvenschraut avatar Dec 02 '25 03:12 kalvenschraut

This issue might be a duplicate of existing issues. Please check:

  • #3750: Bus error (core dumped) after restart - corrupted binary (similar crash behavior on Linux)
  • #3876: Segfaults on musl box (segfault issues on different Linux systems)
  • #4458: pnpm install causes crash (binary crash issues on aarch64 Linux)
  • #1657: opencode crashes with Aborted (core dumped) on NVIDIA GH200 (ARM) (crash on startup)

Feel free to ignore if none of these address your specific case.

github-actions[bot] avatar Dec 02 '25 03:12 github-actions[bot]

yes,I met the same problem on windows11. Bun v1.3.3 (274e01c7) Windows x64 (baseline) Windows v.win11_dt ┃ Build OpenAI GPT 5.1 Codex Max High (OAuth) CPU: sse42 avx avx2 avx512▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ Args: "C:\Users\DGJK\AppData\Roaming\npm\node_modules\opencode-ai\node_modules\opencode-windows-x64\bin\opencode.exe" "--user-agent=opencode/1.0.126" "--" Features: Bun.stderr(4) Bun.stdin(4) Bun.stdout(4) abort_signal(2) fetch(19) http_server jsc spawn(2) standalone_executable workers_spawned Builtins: "bun:ffi" "bun:main" "node:assert" "node:async_hooks" "node:buffer" "node:child_process" "node:console" "node:crypto" "node:events" "node:fs" "node:fs/promises" "node:http" "node:https" "node:module" "node:net" "node:os" "node:path" "node:process" "node:querystring" "node:readline" "node:stream" "node:string_decoder" "node:timers" "node:timers/promises" "node:tls" "node:tty" "node:url" "node:util" "undici" "node-fetch" Elapsed: 16794ms | User: 1406ms | Sys: 390ms RSS: 0.58GB | Peak: 0.63GB | Commit: 0.76GB | Faults: 185807 | Machine: 33.49GB

panic(main thread): Segmentation fault at address 0x3 oh no: Bun has crashed. This indicates a bug in Bun, not your code.

DGJK2301 avatar Dec 02 '25 07:12 DGJK2301

hm idk what change in 116 wouldve caused it assuming same issue for any release after that for you too?

rekram1-node avatar Dec 02 '25 07:12 rekram1-node

yea I am not sure I guess I can try building specific commits locally to try narrow down the problem. I even got my IT to change from qemu emulated CPU to the host CPU which now shows as supporting avx and still seg faults at same spot

kalvenschraut avatar Dec 02 '25 14:12 kalvenschraut

ran a bisect between the two versions since I confirmed I could build locally and get the seg fault on v1.0.116 and build locally and be just fine on v1.0.115 which found the commit https://github.com/sst/opencode/commit/99d7ff47c409a80a9c3b8217e8ca09383f4e70ac caused this issue for me. Which would also explain why I only saw this issue in my project repos, I just see notes on only using it if git is being used

kalvenschraut avatar Dec 03 '25 09:12 kalvenschraut

Looking at https://github.com/sst/opencode/commit/99d7ff47c409a80a9c3b8217e8ca09383f4e70ac#diff-8e39fca798444d6dce95885b0653dd035daeff39b28b7703b933ec5d734a4616R27 , I wonder if this is a musl issue. Trying to use glibc binary instead

oh arch is coming back as arm64 which isnt good for my system its musl/x86. Manually adding https://www.npmjs.com/package/@parcel/watcher-linux-x64-musl as a dependency and requiring that instead statically works.

so @rekram1-node think since early 1.0.0 musl builds are supported need to have better detection for this parcel binary? ~~A little concerning that process.arch was off on my machine for some reason~~ I was mistaken on the arm thing it was just the build erroring due to me trying test things and not related

kalvenschraut avatar Dec 03 '25 09:12 kalvenschraut

https://github.com/oven-sh/bun/pull/18138 so based on that people are using https://www.npmjs.com/package/detect-libc and then need to add all the parcel binary variants that opencode supports as dependencies

kalvenschraut avatar Dec 03 '25 10:12 kalvenschraut

Wow nice find

rekram1-node avatar Dec 03 '25 16:12 rekram1-node

I also encountered this problem when trying to use opencode, but I could only use opencode normally after rolling back to version v1.0.105...

LiefLife avatar Dec 07 '25 00:12 LiefLife

any idea when this will be looked at? I can maybe take a stab at it with opencode itself 😄 . I am currently making it so it works on my system by just manually changing the file to always use musl parcel binary and running build locally.

kalvenschraut avatar Dec 08 '25 20:12 kalvenschraut

I'm working on it rn, I think Tailwind had to solve this same issue so I don't think this should be too hard

rekram1-node avatar Dec 08 '25 21:12 rekram1-node

I think this should fix it: https://github.com/sst/opencode/commit/4dcda3d53d0810daf81e37eb1bca1b8f42a367aa

rekram1-node avatar Dec 08 '25 22:12 rekram1-node

Seems to, I pulled dev and ran build for opencode and the musl binary works with no other changes from me. Thanks!

kalvenschraut avatar Dec 08 '25 22:12 kalvenschraut

sweet

rekram1-node avatar Dec 08 '25 22:12 rekram1-node

Should release tonight

rekram1-node avatar Dec 09 '25 02:12 rekram1-node

released in 1.0.137

rekram1-node avatar Dec 09 '25 05:12 rekram1-node

Thanks, confirmed that version is working for me!

kalvenschraut avatar Dec 09 '25 06:12 kalvenschraut