Repository navigation
Description
Description
Closing a normal interactive opencode session on macOS Apple Silicon triggers a segmentation fault in the embedded Bun runtime. The process crashes during shutdown with a panic(main thread): Segmentation fault, leaving a zsh: trace trap shell message. The crash is consistent and reproduces on every exit.
This looks like a Bun runtime bug surfacing during opencode's teardown — possibly related to microtask draining, SQLite handle cleanup, or unclosed worker handles. The Bun crash report link is the canonical artifact for diagnosing it.
OpenCode version
1.16.2 (installed via brew install anomalyco/tap/opencode)
Plugins
None — stock config, no MCP servers, no custom subagents.
Steps to reproduce
- Install opencode 1.16.2 on macOS Apple Silicon.
- Launch a normal interactive session:
opencode. - Send a message, wait for the response, then exit the TUI cleanly (e.g. Ctrl+C or
/exit). - Observe the panic on shutdown.
The crash does not require any specific prompt content — exiting any session reproduces it.
Screenshot and/or share link
Full crash output:
opencode
▄
█▀▀█ █▀▀█ █▀▀█ █▀▀▄ █▀▀▀ █▀▀█ █▀▀█ █▀▀█
█ █ █ █ █▀▀▀ █ █ █ █ █ █ █ █▀▀▀
▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀
Session Auditoría de configuración y estado de opencode
Continue opencode -s ses_151d20da1ffeDHyzG177vs8LLi
============================================================
Bun v1.3.14 (0d9b296a) macOS Silicon
macOS v26.5.1
CPU: neon fp aes crc32 atomics
Args: "opencode" "--user-agent=opencode/1.16.2" "--use-system-ca" "--"
Features: Bun.stderr(4) Bun.stdin(4) Bun.stdout(4) abort_signal(3) fetch(475) jsc spawn(45) standalone_executable transpiler_cache(3) virtual_modules(2) workers_spawned(2) workers_terminated
Builtins: "bun:ffi" "bun:main" "bun:sqlite" "node:assert" "node:async_hooks" "node:buffer" "node:child_process" "node:console" "node:crypto" "node:dns" "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:stream/consumers" "node:stream/promises" "node:string_decoder" "node:timers/promises" "node:tls" "node:tty" "node:url" "node:util" "node:zlib" "node:worker_threads" "ws" "node:v8" "node:http2" "node:diagnostics_channel" "node:dgram"
Elapsed: 572554ms | User: 106946ms | Sys: 13375ms
RSS: 1.80GB | Peak: 1.81GB | Commit: 0.27GB | Faults: 268 | Machine: 34.36GB
panic(main thread): Segmentation fault at address 0x108400108
oh no: Bun has crashed. This indicates a bug in Bun, not your code.
To send a redacted crash report to Bun's team,
please file a GitHub issue using the link below:
https://bun.report/1.3.14/Ma10d9b296m5BuhogC______2lkjlD______urh5kD27p5tC+xt2yCm9wnCurghJ22j+c+7v4oBA2CwwggoI
zsh: trace trap opencode
Bun crash report (canonical):
https://bun.report/1.3.14/Ma10d9b296m5BuhogC______2lkjlD______urh5kD27p5tC+xt2yCm9wnCurghJ22j+c+7v4oBA2CwwggoI
Notable signals from the dump:
workers_spawned(2) workers_terminated— the terminated count is missing in the report, suggesting one or more workers were not cleanly stopped before exit.abort_signal(3)is enabled, so the shutdown path goes through signal-driven teardown.bun:sqlitebuiltin is loaded — SQLite handle cleanup during exit is a plausible contributor.standalone_executable— confirms the binary bundles its own Bun runtime; the systembun(1.3.9 in~/.bun/bin/) is not involved.
Operating System
macOS 26.5.1 (Darwin), Apple Silicon (M-series)
Terminal
zsh (default macOS shell). Crash reproduces in both Ghostty and macOS Terminal.
Activity
NachoBasilio commentedon Jun 26, 2026
Seeing the same shutdown crash pattern on Linux under WSL, with an older embedded Bun.
Environment from the crash dump:
--user-agent=opencode/1.3.151.3.116.6.87Repro is also simple here:
opencodesessionpanic(main thread): Segmentation faultCanonical Bun crash report:
https://bun.report/1.3.11/Ba1af24e28m5HuhogC4ktn4E+ypR____45z1iE45z1iE_45z1iE______m80tiEsi4jrF+895vF0i73qEA2+54Bwtgg/U
The bun.report page points at
Bun::JSNextTickQueue::drain, so this also looks like teardown or event loop cleanup rather than user code.Given this and the macOS report above, it looks cross-platform and tied to shutdown in the bundled Bun runtime.
naturedamends commentedon Aug 23, 2026
using the latest version
1.18.21this is the first time i have seen this. I just changed my base image from the offical docker file to alpine with the same code. And copying the bun binary over from the offical repo into my alpine container.
thdxr commentedon Oct 11, 2026
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (
opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊