fix: claims plugin fails to load (unresolvable @opencode/plugin import) #16

Closed
opened 2026-11-05 03:00:18 +00:00 by david · 0 comments
Owner

The plugin registered as failed with only "Plugin failed to load" and a per-attempt reference (err_7dd8e193, later err_8e57cbb8). The reference appears nowhere in ~/.local/share/opencode/log/opencode.log, so the server log does not carry the underlying error at the default INFO level.

Root cause isolated by controlled experiment (each row is a real plugin directory the server loaded):

File Imports Result
index.js none active
index.ts none active
index.ts @opencode/plugin failed
index.ts @opencode-ai/plugin failed

TypeScript, the default export and the hook were all fine. Bare package specifiers do not resolve for a local plugin loaded by path. @opencode/plugin is not installed anywhere on disk (the runtime defines it internally for its own TUI plugin), and @opencode-ai/plugin@1.2.27 is the V1 package, whose API has no Plugin.define.

Fix

Drop the import. Plugin.define is an identity function in the runtime, so exporting the definition object directly is equivalent. Only node: builtins are used, and those resolve.

Status after the change: active, id knox.claims.

The plugin registered as `failed` with only "Plugin failed to load" and a per-attempt reference (`err_7dd8e193`, later `err_8e57cbb8`). The reference appears **nowhere** in `~/.local/share/opencode/log/opencode.log`, so the server log does not carry the underlying error at the default INFO level. Root cause isolated by controlled experiment (each row is a real plugin directory the server loaded): | File | Imports | Result | |---|---|---| | `index.js` | none | active | | `index.ts` | none | active | | `index.ts` | `@opencode/plugin` | failed | | `index.ts` | `@opencode-ai/plugin` | failed | TypeScript, the default export and the hook were all fine. **Bare package specifiers do not resolve for a local plugin loaded by path.** `@opencode/plugin` is not installed anywhere on disk (the runtime defines it internally for its own TUI plugin), and `@opencode-ai/plugin@1.2.27` is the V1 package, whose API has no `Plugin.define`. ## Fix Drop the import. `Plugin.define` is an identity function in the runtime, so exporting the definition object directly is equivalent. Only `node:` builtins are used, and those resolve. Status after the change: `active`, id `knox.claims`.
david closed this issue 2026-11-05 03:01:02 +00:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: david/knox#16