Skip to content

Versions after 1.2.10 use unstable bun canary version which lead to loading project root .env files into bun and crashes opencode on startup #15056

Closed

Description

@kovaaf

Description

opencode crashes on startup due to instable bun canarry version loading .env file from project root directory.

Plugins

oh-my-opencode

OpenCode version

1.2.10 last stable, 1.2.11-1.2.13 crashing

Steps to reproduce

  1. Place any .env file into root project directory
  2. Make sure that you use opencode version 1.2.11 or higher (till 1.2.13 tested)
  3. run in terminal "opencode"
  4. Get the error:

Bun Canary v1.3.10-canary.100 (6b1d6c76) Windows x64 (baseline)
Windows v.win10_cu
CPU: sse42 avx avx2
Args: "C:\Users\Professional\scoop\apps\opencode\current\opencode.exe" "--user-agent=opencode/1.2.12" "--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: 753ms | User: 703ms | Sys: 281ms
RSS: 0.54GB | Peak: 0.54GB | Commit: 0.89GB | Faults: 138710 | Machine: 34.16GB

panic(thread 10416): Internal assertion failure: ThreadLock is locked by thread 14580, not thread 10416
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.10/ea26b1d6c7kQugogC+iwgN+xxuK4t2wM8/pM2rmNkxvNm9mQwwn0eCYKERNEL32.DLLo05FCSntdll.dllirzUA0eNrzzCtJLcpLzFFILC5OLSrJzM9TSEvMzCktSrVSSAjJKEpNTPHJT85OUMgsVsjJT85OTVFIqlQoAUsoGJqYWhjoKOTll8BEDA1MDM0AGl0czQ

  1. Remove .env file or set up opencode version to 1.2.10 and opencode starting again

Screenshot and/or share link

No response

Operating System

Windows 11

Terminal

Windows Powershell

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Feb 25, 2026
  2. github-actions commented on Feb 25, 2026

    @github-actions
    Contributor

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

    These issues describe the same or very similar symptoms: .env file in project root + Bun Canary ThreadLock panic causing opencode to crash on startup in versions 1.2.11+.

  3. FJRG2007 commented on Feb 25, 2026

    @FJRG2007

    I also get this error.

  4. zhenzhuzz commented on Feb 25, 2026

    @zhenzhuzz

    Confirmed workaround: move .env to parent directory

    Besides downgrading to v1.2.10, I found a cleaner persistent workaround:
    move the .env file one level up to the parent directory of your project.

    Before (crashes):

    D:\myproject.env ← Bun auto-loads this → ThreadLock panic

    After (works):

    D:
    └── .env ← Bun doesn't scan parent dirs → no crash
    └── myproject\ ← run opencode from here, works fine

    This is cleaner than temporarily renaming because the file stays permanently
    accessible (source ../.env still works for loading API keys).


    Secondary symptom: terminal stuck in mouse-tracking mode after crash

    When OpenCode crashes due to this bug, the terminal is left in mouse-tracking
    mode. Any subsequent mouse scroll or click prints raw SGR sequences
    (screenshot 1 below — this happens continuously until you open a new terminal tab):

    Image

    The Bun crash itself looks like this (screenshot 2):

    Image

    Git Bash also works after the fix

    After moving .env out of the project root, OpenCode works normally in
    Git Bash (Windows Terminal) — not just PowerShell. The terminal corruption
    from the crash was making Git Bash appear incompatible, but it works fine
    once the crash is prevented.


    Environment: Windows 11, OpenCode v1.2.12, Windows Terminal (Git Bash + PowerShell)


  5. DomEscobar commented on Feb 25, 2026

    @DomEscobar
  6. Hona commented on Feb 26, 2026

    @Hona
    Member

    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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)windows

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions