Description
opencode attach <url> --dir <PATH> reliably segfaults (Bun crash) when no existing session on the server has a cwd matching <PATH>. Attaching to a --dir that does have matching sessions works (TUI loads).
This looks related to the session().parentID family (#6874, #6964, #6867, #6977) — the TUI route appears to assume a session exists, and Bun then panics in the microtask drain instead of erroring gracefully.
panic(main thread): Segmentation fault at address 0x103EE1B5C
oh no: Bun has crashed.
Bun crash report (consistent hash across runs):
https://bun.report/1.3.13/Ma1bf2e2ceEugogC_______2lumjD2lumjD2lumjD2lumjDurr8iDm8t3zC+ml0zC29vz2C2ovz2C+94r4C29u7B__A2C41t49D
Stack frame from bun.report:
Bun::jsFunctionDrainMicrotaskQueue (BunProcess.cpp:3532)
JSC::MicrotaskQueue::drain<true>
JSC::runMicrotask → JSC::runInternalMicrotask (JSMicrotask.cpp)
- llint call → unknown JS code
Plugins
None relevant — reproduces with stock config.
OpenCode version
1.15.4 (embedded Bun 1.3.13)
Steps to reproduce
- Start an
opencode server (e.g. opencode serve --port 4096).
- Confirm no session on that server has a cwd matching
/tmp/empty-dir-test:
curl -s http://localhost:4096/session | jq -r '.[].directory' | sort -u
- Run:
mkdir -p /tmp/empty-dir-test
cd /tmp/empty-dir-test
opencode attach http://localhost:4096 --dir "$PWD"
- Expected: friendly error like "no session for this directory" or new-session prompt.
- Actual: Bun segfault within ~2s.
Reproduces with and without a PTY (script -q /dev/null bash -c '…' also crashes).
Sanity check — attaching to a dir that does have sessions works:
opencode attach http://localhost:4096 --dir / # TUI loads
Screenshot and/or share link
n/a
Operating System
macOS 26.3.1 (Darwin 25.3.0) arm64
Terminal
Reproduces in zsh, bash, and under script/PTY. Not terminal-specific.
Description
opencode attach <url> --dir <PATH>reliably segfaults (Bun crash) when no existing session on the server has a cwd matching<PATH>. Attaching to a--dirthat does have matching sessions works (TUI loads).This looks related to the
session().parentIDfamily (#6874, #6964, #6867, #6977) — the TUI route appears to assume a session exists, and Bun then panics in the microtask drain instead of erroring gracefully.Bun crash report (consistent hash across runs):
https://bun.report/1.3.13/Ma1bf2e2ceEugogC_______2lumjD2lumjD2lumjD2lumjDurr8iDm8t3zC+ml0zC29vz2C2ovz2C+94r4C29u7B__A2C41t49D
Stack frame from bun.report:
Bun::jsFunctionDrainMicrotaskQueue(BunProcess.cpp:3532)JSC::MicrotaskQueue::drain<true>JSC::runMicrotask→JSC::runInternalMicrotask(JSMicrotask.cpp)Plugins
None relevant — reproduces with stock config.
OpenCode version
1.15.4 (embedded Bun 1.3.13)
Steps to reproduce
opencodeserver (e.g.opencode serve --port 4096)./tmp/empty-dir-test:Reproduces with and without a PTY (
script -q /dev/null bash -c '…'also crashes).Sanity check — attaching to a dir that does have sessions works:
opencode attach http://localhost:4096 --dir / # TUI loadsScreenshot and/or share link
n/a
Operating System
macOS 26.3.1 (Darwin 25.3.0) arm64
Terminal
Reproduces in zsh, bash, and under
script/PTY. Not terminal-specific.