Skip to content

Bun/opencode crashes with NAPI fatal error when opencode-magic-context is enabled on macOS arm64 #95

@Suknna

Description

@Suknna

Environment

  • opencode: 1.15.10
  • Bun: 1.3.14
  • macOS: 26.4.1
  • CPU: Apple Silicon / arm64
  • Plugin: @cortexkit/opencode-magic-context@latest

Symptom

opencode crashes after running for a while when @cortexkit/opencode-magic-context@latest is enabled.

The terminal crash output includes:

panic: NAPI FATAL ERROR: Error::New napi_create_error
oh no: Bun has crashed. This indicates a bug in Bun, not your code.
zsh: trace trap  opencode

Evidence

The macOS crash report for the opencode process shows native modules loaded in the process:

onnxruntime_binding.node
libonnxruntime.1.24.3.dylib
sharp-darwin-arm64.node
libvips-cpp.8.17.3.dylib

Those modules appear to come from the @cortexkit/opencode-magic-context dependency tree, specifically the ONNX / transformers and sharp / libvips native dependencies.

Workaround

Removing @cortexkit/opencode-magic-context@latest from both opencode's global plugin list and TUI plugin list avoids loading those native modules. After removing it, opencode can load config and list models normally:

opencode models newapi --print-logs

The startup logs no longer include @cortexkit/opencode-magic-context@latest and opencode successfully initializes the remaining plugins.

Expected behavior

The plugin should not crash the host opencode / Bun process. If native dependencies are required, it would be helpful for the plugin to either avoid incompatible native paths under Bun or document a supported runtime / version matrix.

Notes

This may ultimately be a Bun native-addon crash, but the practical trigger appears to be enabling @cortexkit/opencode-magic-context@latest in opencode on macOS arm64.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions