Skip to content

Opencode keeps crashing despite updating bun to latest version #30424

Closed as not planned

Activity

  1. robobun commented on May 9, 2026

    @robobun
    Collaborator

    Unable to reproduce this.

    Crash reports decoded

    Bun version: 1.3.13 (bf2e2ce) on macOS aarch64 [StandaloneExecutable]

    Crash 1

    panic: NAPI FATAL ERROR: Error::New napi_create_error
    Features: spawn, standalone_executable, virtual_modules,
              workers_spawned, workers_terminated,
              napi_module_register, process_dlopen, exited,
              Bun.stderr, Bun.stdin, Bun.stdout, fetch, jsc
    

    Crash 2

    panic: A C++ exception occurred
    - BunProcess.cpp:2993  Bun::Process_functionReallyExit
    - BunProcess.cpp:851   Bun::Process_functionExit
    - MicrotaskCallInlines.h:84  JSC::MicrotaskCall::tryCallWithArguments<...>
    Features: spawn, standalone_executable, transpiler_cache, virtual_modules,
              workers_spawned, workers_terminated,
              napi_module_register, process_dlopen, exited,
              Bun.stderr, Bun.stdin, Bun.stdout, fetch, jsc
    

    Analysis

    Crash 1 is the same NAPI finalizer panic already investigated in
    #30286 and fixed in PR #30291 ("napi: clear pending exceptions between
    finalizers during env cleanup"). Root cause per that PR:

    1. NapiEnv::cleanup did not clear pending exceptions between finalizers
      — a throw from one finalizer bled into the next.
    2. napi_create_error refused to run with a pending VM exception,
      unlike Node.js. Combined with napi_is_exception_pending skipping
      the VM check during cleanup, node-addon-api's Error::New(env)
      tripped NAPI_FATAL_IF_FAILED → the panic.

    Feature fingerprints match: napi_module_register, process_dlopen,
    workers_spawned, workers_terminated — a native module (tree-sitter
    is commonly used inside opencode) throwing during worker shutdown.

    Crash 2 is a C++ exception caught while process.exit() runs from a
    microtask — consistent with the same shutdown scenario where a thrown
    value escapes into JSC's microtask queue during worker exit.

    Both crash reports originate from the same user's opencode session and
    share the same feature fingerprint — consistent with the same root cause.

    Next step

    Track under #30286 / PR #30291. No new work needed — close as duplicate
    once that PR merges.

    If you can provide a minimal reproduction (exact command, Bun version, platform), please update the issue.


    Automated investigation. Reopen with more context if this is wrong.

  2. github-actions commented on May 9, 2026

    @github-actions
    Contributor

    Found 3 possible duplicate issues:

    1. Crash with a segmentation fault at address 0x3C #29497
    2. Opencode causing Bun crash #24320
    3. Segmentation Fault in Bun v1.3.5 on Windows 10 x64 During Opencode Execution #26026

    This issue will be automatically closed as a duplicate in 3 days.

    • If your issue is a duplicate, please close it and 👍 the existing issue instead
    • To prevent auto-closure, add a comment or 👎 this comment

    🤖 Generated with Claude Code

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions