Skip to content

Windows: NAPI FATAL ERROR crash on v1.15.3 (Bun runtime bug, fix PR exists upstream) #28046

Closed as not planned

Description

@skywalker-35

Description

Starting a session on Windows immediately crashes with a Bun NAPI fatal error:

panic(thread 17676): NAPI FATAL ERROR: Error::New napi_create_error

This indicates a bug in Bun, not your code. The panic occurred at:
  /home/runner/work/bun/bun/packages/bun/src/bun.js/node/types/napi.zig — line:373 col:32

Screenshot attached showing the full crash log.

Environment

  • OS: Windows 11
  • opencode version: 1.15.3 ❌ → 1.15.0 works ✅
  • Bun version (system): 1.3.14
  • Plugins: oh-my-openagent@4.1.1, opencode-mem@2.14.1

Steps to Reproduce

  1. Install opencode-ai@1.15.3 via npm on Windows 11
  2. Run opencode in any project directory
  3. Start a session → crashes within seconds

Workaround

npm install -g opencode-ai@1.15.0

Root Cause (confirmed by Bun team)

This is a Bug in Bun's embedded runtime inside the standalone opencode.exe binary. Confirmed in oven-sh/bun#30286:

  • NapiEnv::cleanup does not clear pending exceptions between finalizers
  • napi_create_error refuses to run with a pending VM exception (unlike Node.js)
  • Combined → NAPI FATAL ERROR panic during worker shutdown

Fix PR exists: oven-sh/bun#30291

Related

Request

Recompile the Windows binary with a Bun version that includes the fix from PR #30291.

Activity

  1. skywalker-35 commented on May 17, 2026

    @skywalker-35
    Author
    Image
  2. skywalker-35 commented on May 17, 2026

    @skywalker-35
    Author

    @Hona FYI — the root cause is a Bun N-API bug (oven-sh/bun#30286) with a fix PR already submitted (oven-sh/bun#30291). The crash only occurs on v1.15.3; downgrading to v1.15.0 works. Recompiling the Windows binary with a Bun version that includes PR #30291 should resolve this.

  3. jkemp814 commented on Jun 15, 2026

    @jkemp814

    Can confirm this also hits Linux x86_64 (Fedora Linux Silverblue 44) on opencode v1.17.7 (embedded Bun v1.3.14). In my case it manifested as Illegal instruction (core dumped) / exit 132 (SIGILL) after a 4.5-hour session, with the same NAPI FATAL ERROR: Error::New napi_create_error panic preceding it. The SIGILL likely suggests the bug hit an AVX/AVX2 code path during the NAPI cleanup.

    panic: NAPI FATAL ERROR: Error::New napi_create_error
    oh no: Bun has crashed. This indicates a bug in Bun, not your code.
    https://bun.report/1.3.14/Ba10d9b296mxHugooCwgvypDq+6xpDA0eNrzcwzwVHBzDHH0UXANCvIPslJwLSrKL7Ky8kstV8hLLMiMTy5KTSxJjU8FCQMASAIPgQ
    ^C
    Illegal instruction (core dumped)
    

    CPU: Intel with SSE4.2, POPCNT, AVX, AVX2 — so the illegal instruction is almost certainly from a miscompiled or unsupported code path in the embedded Bun, not from an actual unsupported instruction.

  4. github-actions commented on Aug 15, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

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