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
Plugins: v2 definition API exposes no tool/event registration - v1 hook-map plugins fail every load, docs still show the v1 shape #56630
OpenCode 2.x rejects v1-style plugin modules (default export = async function returning a hooks object), and the v2 plugin API offers no replacement surface for the two things those plugins existed to do: registering custom tools and subscribing to file/tool/session events. The plugins documentation still shows the v1 shape, so authors hit a schema error at load time with no documented migration path.
What happens
On 2.0.29, a local plugin written against the documented v1 API fails on every startup and reload:
failed to load plugin ... PluginModule.LoadError: Plugin must export a default
definition with an id and an effect or setup function. (cause: SchemaError(Expected
object at ["default"])))
This repeats for the lifetime of the log. At least one published project (ECC / ecc-universal, filed upstream as its own issue) is affected this way today.
Migration gap
A definition shim ({ id, setup }) makes the module load, but setup(context) exposes only: agent, aisdk, catalog, command, integration, plugin, reference, skill. There is no way to register a tool (v1 returned tool: { ... }) or to subscribe to tool.execute.*, file.edited, session.*, shell.env, permission.*.
https://opencode.ai/docs/plugins still documents "export one or more plugin functions … returns a hooks object" with those event names, and the config docs still list the same shape — docs and runtime disagree.
Configured plugin entries also changed behaviour: a file://…mjs entry now logs configured plugin path must be a directory.
Requests
Align the plugins doc with the v2 definition contract — or restore loading of the documented v1 shape if it is still meant to be supported.
Expose tool/event registration from setup(context), or document an explicit migration path for v1 hook maps, so existing plugins can move deliberately instead of failing at load with a schema error.
Document the accepted forms of configured plugin entries (npm name / directory / …).
Thanks for the detailed write-up! I think this is a duplicate of #48138, which asks for v1 hook-map plugins to keep loading in v2 (or to fail with a clear migration hint instead of a bare schema error).
One correction that may unblock you now: in 2.0.29 the context passed to setup(ctx)does expose tool and event registration. The Context type includes tool, event, shell, session, permission and more, not only the domains you listed. The v2 "Migrate plugins from V1" guide maps each v1 hook to its v2 replacement, for example:
The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different, for example if a ctx.tool / ctx.event based plugin still doesn't work for you on 2.0.29.
To port a plugin now: the v2 setup(ctx) context already has tool and event registration. Use ctx.tool.transform(...) and ctx.tool.hook("execute.before" | "execute.after", ...) for tools, ctx.event.subscribe() for events and ctx.shell.hook("create.before", ...) in place of shell.env. The v2 "Migrate plugins from V1" guide maps every v1 hook. If a ctx.tool / ctx.event based plugin still doesn't work for you on 2.x, please open a new issue with the plugin code and the log output.
Activity
opencode-agent commentedon Oct 18, 2026
Thanks for the detailed write-up! I think this is a duplicate of #48138, which asks for v1 hook-map plugins to keep loading in v2 (or to fail with a clear migration hint instead of a bare schema error).
One correction that may unblock you now: in 2.0.29 the context passed to
setup(ctx)does expose tool and event registration. TheContexttype includestool,event,shell,session,permissionand more, not only the domains you listed. The v2 "Migrate plugins from V1" guide maps each v1 hook to its v2 replacement, for example:tool: { ... }mapctx.tool.transform((editor) => editor.add(...))tool.execute.before/afterctx.tool.hook("execute.before" / "execute.after", ...)event(file / session events)ctx.event.subscribe()shell.envctx.shell.hook("create.before", ...)permission.askctx.permission.hook("evaluate", ...)The
opencode.ai/docs/pluginspage you found documents the v1 API, which is why it shows the hook-map shape.Possible duplicates and closely related issues, ordered from most to least likely:
Expected object at ["default"]schema error for a function default exportfile://) dropped withconfigured plugin path must be a directory(your request 3)The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different, for example if a
ctx.tool/ctx.eventbased plugin still doesn't work for you on 2.0.29.opencode-agent commentedon Oct 19, 2026
Closing this as a duplicate of #48138, since there's been no reply in the last day saying how this differs.
The remaining asks are tracked here:
Expected object at ["default"]schema error, and the missing docsfile://and file-path plugin entries rejected withconfigured plugin path must be a directoryTo port a plugin now: the v2
setup(ctx)context already has tool and event registration. Usectx.tool.transform(...)andctx.tool.hook("execute.before" | "execute.after", ...)for tools,ctx.event.subscribe()for events andctx.shell.hook("create.before", ...)in place ofshell.env. The v2 "Migrate plugins from V1" guide maps every v1 hook. If actx.tool/ctx.eventbased plugin still doesn't work for you on 2.x, please open a new issue with the plugin code and the log output.