Skip to content

Shell tool crashes with SIGTRAP on linux/arm64 (web-tree-sitter Parser.init in JSC) #34054

Description

@darius-f96

Summary

On linux/arm64, OpenCode crashes with SIGTRAP the first time the shell tool runs any command. The crash happens inside web-tree-sitter's Parser.init() (WASM module initialization), which the shell tool calls to scan a command for the paths it touches (used by the permission system).

Because every shell command triggers this path, OpenCode is effectively unusable on linux/arm64.

Environment

  • Platform: linux/arm64 (aarch64) — reproduced on an NVIDIA GB10 (Grace, ARMv9)
  • Bun: 1.3.14
  • web-tree-sitter: 0.25.10
  • OpenCode: built from source on current dev

Repro

  1. Build/run OpenCode on a linux/arm64 host with Bun 1.3.14.
  2. Issue any prompt that makes the model run a shell command (e.g. ls).
  3. Process dies with SIGTRAP before the command runs.

Root cause

The fault originates in JavaScriptCore when web-tree-sitter initializes its WASM modules via Parser.init() in packages/opencode/src/tool/shell.ts (the parse() helper, ~line 312).

The faulting address is 0xE3C500000012 — above the 48-bit virtual-address space — which points at tagged-pointer / NaN-boxing corruption in JSC on aarch64 rather than a logic bug in OpenCode itself. So this is fundamentally a Bun/JSC-on-aarch64 issue, but it makes OpenCode crash hard (a SIGTRAP panic can't be caught from JS).

Impact / tradeoff

The tree-sitter scan exists only to feed the permission system (detecting which directories a command would access). On linux/arm64 today the choice is binary: crash on every command, or skip the scan. There's no graceful in-JS fallback because the panic is uncatchable.

Proposed fix

Guard the scan so it's skipped on linux/arm64, keeping OpenCode usable on the platform. Downside: the directory-access permission scan is disabled there until the upstream Bun/JSC issue is fixed. Happy to gate it more narrowly (env opt-out, warn-once, etc.) if the team prefers — opening a PR with the minimal version and will reference this issue.

Is there a preferred direction here before I finalize the PR?

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