anomalyco / anomalyco/opencode

CLI 1.18.30 Linux: npm-spec plugin in opencode.json never initializes (silent); identical code as a file:// plugin works

Open
#48,379 0 comments 0 reactions 1 assignee View on GitHub

@nexxeln is already working on this.

Since Sep 10, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Environment

opencode-ai 1.18.30 (npm global, Bun-compiled binary)
OS Linux x64
Bun 1.3.14 on PATH
Plugin opencode-token-norm 0.3.0 (ESM, named plugin-function exports, dependencies installed)

Symptom

A server-side plugin listed in the global opencode.json plugin array never initializes on the CLI. No error, no warning, no service=plugin line even with --log-level DEBUG, no tools, no hooks.

This is not the lazy-loading behavior documented in #33455: tool calls execute in the same run, and a local probe plugin's tool.execute.after hook fires on those calls, while the npm-spec plugin does nothing.

Evidence

opencode debug config resolves the entry and records its provenance:

"plugin": ["opencode-token-norm", ...],
"plugin_origins": [
  { "spec": "opencode-token-norm", "source": "/home/alitabatabaei/.config/opencode", "scope": "global" }
]

opencode plugin opencode-token-norm --global populated ~/.cache/opencode/packages/opencode-token-norm{,@latest}/. That install is valid — node_modules/opencode-token-norm/dist/index.js imports under Node 24 and exports both plugin functions. The runtime cache documented at https://opencode.ai/docs/plugins/ ("How plugins are installed": Bun installs npm plugins at startup into ~/.cache/opencode/node_modules/) does not exist. Cf. #32421.

Same run, two plugins, one works:

  • .opencode/plugins/probe.js (local file spec): initialized, and its tool.execute.after hook fired on the bash call.
  • opencode-token-norm (npm spec): nothing.

The identical code loaded as a local file spec — ~/.config/opencode/plugins/opencode-token-norm.js containing export * from "file:///.../dist/index.js" — initializes on the first tool call and works end to end (threshold reminder fired, handoff tool registered).

Repro

opencode run --print-logs --log-level DEBUG \
  "Run the bash command 'echo hi' exactly once using the bash tool, then reply ok"
# => zero plugin-related log lines

Suspected

The npm-spec install path (opencode plugin CLI → ~/.cache/opencode/packages/) is not wired to the runtime loader, and the failure is swallowed (#47200). It looks like server-side npm-spec loading is never attempted on this build, rather than attempted and failed. #33884 notes that server-side npm-spec plugins load fine in 1.17.10; on 1.18.30 Linux they do not.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.