Skip to content

fix(opencode): resolve WASM load error in LLM bash tool - #51969

Open
rkilchmn wants to merge 1 commit into
anomalyco:devfrom
rkilchmn:llm-bash-error
Open

rkilchmn wants to merge 1 commit into
anomalyco:devfrom
rkilchmn:llm-bash-error

Conversation

@rkilchmn

@rkilchmn rkilchmn commented Sep 29, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #40789

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Fixes undefined is not an object (evaluating 'H.loadWebAssemblyModule') when the LLM runs the bash tool (issue #40789: Bash tool broken on macOS arm64).

  • packages/opencode/src/tool/shell.ts: Language and Parser are now imported from the same web-tree-sitter module instance, preventing the WASM module state mismatch that caused the crash
  • Adds WASM diagnostic utilities (wasm-diag.mjs, wasm-diag-main.mjs, wasm-diag-worker.mjs) for debugging WASM issues

How did you verify your code works?

Ran the bash tool through a session (TUI and headless) and confirmed the H.loadWebAssemblyModule crash no longer occurs; bun turbo typecheck passes.

Screenshots / recordings

Not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

…is not an object (evaluating 'H.loadWebAssemblyModule')

add WASM diagnostic tools and fix tree-sitter imports

Add a new set of WASM diagnostic utilities including a main entry point,
a worker script, and a diagnostic module to assist in debugging WASM-
related issues within the opencode package.

Refactor `packages/opencode/src/tool/shell.ts` to ensure `Language` and
`Parser` are imported from the same `web-tree-sitter` module instance,
preventing state mismatch when loading WASM modules.
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels Sep 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@github-actions github-actions Bot removed needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels Sep 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Bash tool broken on macOS 26 (arm64): H.loadWebAssemblyModule Bun WASM crash, TUI and headless

1 participant