You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Plugin API: ctx.tool.transform tools.add crashes with TypeError '_.name.replace' on undefined (beta-17498) #43753
opencode2 v0.0.0-beta-17498 (npm @opencode-ai/cli@next, Linux x64)
Description
Plugin-registered tools via ctx.tool.transform((tools) => tools.add(...)) fail to load with an internal Effect error. The plugin id appears in /api/plugin from a bare-load generation, but every generation that calls tools.add dies during activation.
Repro
Minimal plugin in ~/.config/opencode/plugins/broken.js:
level=WARN message="failed to load plugin" plugin.id=broken cause="Cause([Die(TypeError: undefined is not an object (evaluating '_.name.replace'))])"
Observations
A plugin whose setup does nothing except console.log loads fine, so the crash is specifically in the tool registration path.
The documented third-argument options form (tools.add("browse", def, { namespace: "skills" })) crashes the same way.
Adding an output JSON Schema makes no difference; the crash also happens without it.
Same failure on two different plugin files and across watcher-triggered reloads, so it is not a race in my file editing.
Docs at /v2/docs/build/plugins describe both call shapes; at least one of them appears broken on this beta.
Expected
tools.add(name, definition) registers a tool that is exposed to the model (and via CodeMode), or returns a validation error naming the offending field.
Environment
Linux x64, Bun runtime bundled with the CLI, plugins auto-discovered from ~/.config/opencode/plugins/.
Activity
fix(plugin): support tools.add(name, tool, options?) registration form
fix(plugin): support tools.add(name, tool, options?) registration form
github-actions commentedon Oct 21, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.