Repository navigation
Description
Description
opencode crashes immediately on startup when the working directory contains a .env file with any content. An empty .env file does not trigger the crash.
Steps to reproduce:
Create a .env file in the working directory with any content, even a single line like WP_BASE_URL=localhost
Run opencode from that directory
opencode crashes immediately
Expected behavior: opencode starts normally and reads the .env file.
Workaround: Removing or emptying the .env file prevents the crash.
Error output:
Bun v1.3.10-canary.100 (6b1d6c76) Windows x64 (baseline)
panic(thread 24096): Internal assertion failure: ThreadLock is locked by thread 22284, not thread 24096
oh no: Bun has crashed. This indicates a bug in Bun, not your code.
Additional notes:
The crash occurs regardless of the content of the .env file (tested with URLs, plain strings, special characters)
The crash does not occur when running opencode from a directory without a .env file
The issue is specific to the bundled Bun canary version — system Bun is stable and unaffected
Plugins
No response
OpenCode version
1.2.14
Steps to reproduce
No response
Screenshot and/or share link
Bun Canary v1.3.10-canary.100 (6b1d6c76) Windows x64 (baseline)
Windows v.win11_dt
CPU: sse42 avx avx2
Args: "C:\Users\detre\AppData\Roaming\npm\node_modules\opencode-ai\node_modules\opencode-windows-x64\bin\opencode.exe" "--user-agent=opencode/1.2.14" "--use-system-ca" "--"
Features: Bun.stderr(2) Bun.stdin(2) Bun.stdout(2) fetch(2) jsc standalone_executable workers_spawned
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" "node:timers/promises" "node:tls" "node:tty" "node:url" "node:util" "undici" "node:v8" "node:http2" "node:diagnostics_channel" "node:dgram"
Elapsed: 1290ms | User: 1390ms | Sys: 312ms
RSS: 0.52GB | Peak: 0.52GB | Commit: 0.86GB | Faults: 136672 | Machine: 33.76GB
panic(thread 15748): Internal assertion failure: ThreadLock is locked by thread 25004, not thread 15748
oh no: Bun has crashed. This indicates a bug in Bun, not your code.
Operating System
No response
Terminal
No response
Activity
github-actions commentedon Feb 25, 2026
This issue might be a duplicate of existing issues. Please check:
These issues all describe the same root cause: the bundled Bun canary version loading the project's
.envfile and triggering aThreadLockpanic on startup.letruxux commentedon Feb 25, 2026
can confirm i have the same issue
HaydenDekker commentedon Feb 25, 2026
can confirm experiencing the same issue to.
sebysebyseby commentedon Feb 26, 2026
Same issue here. I've noticed that cd'ing into a subdirectory and running opencode from there works though even if there is content in the .env file.
ChrisColeTech commentedon Feb 26, 2026
What a bizarre bug.
Thank you for the solution
Hona commentedon Feb 26, 2026
It's a bug with Bun. I've submitted an issue and PR. I'm working with their team to get it out asap. Thanks everyone.
Specifically if there is a .env in your startup directory it will crash.
Hona commentedon Feb 26, 2026
please upgrade to latest OpenCode v1.2.15 - and try again.
There should be no more segfaults/crashes.
Can you confirm it works fine after the version is >v1.2.15 :)
Shabba-D commentedon Feb 26, 2026
Yes, it works fine now.
Thank you for the quick response.