anomalyco / anomalyco/opencode
plugins for V2: local plugin paths fail to load (file entries rejected, @opencode/plugin unresolvable)
@jlongster is already working on this.
Since Sep 17, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
A local plugin cannot be loaded by following the documentation.
-
A
pluginsentry pointing at a.tsfile is rejected with
WARN "configured plugin path must be a directory", and the plugin never loads. The plugins
documentation shows exactly this form (./plugins/local,../shared/plugin.ts,
/absolute/path/plugin.ts,file:///home/me/plugins/local). -
An entry pointing at a directory (or a plugin discovered under
.opencode/plugins/) is found and
imported, but loading fails because the documented import is not resolvable:level=INFO message="loading plugin" id=…/mi-plugin entrypoint=file:///…/mi-plugin/index.ts level=WARN message="failed to load plugin" cause="Cause([Die(ResolveMessage: Cannot find package '@opencode/plugin' imported from …\mi-plugin\index.ts)])"This happens with both loading paths (config entry and discovery). It only works if the plugin
directory ships its ownnode_modules.
In both cases the failure is silent outside the log — no error in the session, no hint in the TUI —
so the only visible symptom is that the plugin's tools and hooks do not exist.
Plugins
None configured globally. The reproductions use a single project entry in opencode.jsonc and a
directory under .opencode/plugins/.
OpenCode version
2.0.3 (@opencode/cli installed globally with npm)
Steps to reproduce
A. plugins entry pointing at a .ts file
-
Create a local plugin with a single default export:
export default { id: "x", setup() {} }. -
Configure the entry:
{ "plugins": ["C:/absolute/path/mi-plugin/index.ts"] }. -
Start any session in that project (
opencode run --standalone --print-logs --log-level info).Log:
level=WARN message="configured plugin path must be a directory" target=C:/absolute/path/mi-plugin/index.ts
B. Directory entry or .opencode/plugins/ discovery importing @opencode/plugin
-
Create
<project>/.opencode/plugins/mi-plugin/index.ts:import { Plugin } from "@opencode/plugin" export default Plugin.define({ id: "mi-plugin", async setup() {}, }) -
Start a session in that project.
The module is found, then loading fails with the
Cannot find package '@opencode/plugin'cause above.
Screenshot and/or share link
N/A — both failures are only visible in the server log; the log lines are quoted above.
Operating System
Windows 10 Enterprise LTSC 10.0.19044 (x64)
Terminal
Not applicable: reproduced headlessly with opencode run --standalone from PowerShell 5.1
(TERM=xterm-256color, TERM_PROGRAM unset, %COMSPEC% = cmd.exe).
Additional context (not part of the form):
- Workarounds that work: export a plain object (
export default { id, setup }) instead of
Plugin.define; or run an install inside the plugin directory so@opencode/pluginresolves
locally (@opencode/plugin@2.0.5is published on npm). - Why this matters: the first case is a documentation/behaviour mismatch, and the second blocks
every local (non-published) plugin that follows the documented import. Both fail silently, which
makes them expensive to diagnose. - Notes: tested with the path written as
C:/…andC:\…;opencode plugin listdoes not load
project plugins, so it cannot be used to verify. Reproduced consistently on 2.0.3.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.