Problem
When a plugin listed in opencode.json does not exist on npm, the plugin loader
fails with a 404 error and silently swallows the plugin — providers login then
returns "Unknown provider" with no actionable message.
The loader unconditionally runs:
opencode add --force --exact --ignore-scripts --cwd ~/.cache/opencode @latest
even when the package is already present in node_modules or when a local path is intended.
Reproduction
- Create a local plugin at
~/.config/opencode/node_modules/my-plugin/
- Add
"plugin": ["my-plugin"] to opencode.json
- Run
opencode providers login --provider <id-registered-by-plugin>
- Result: "Unknown provider" (npm 404 kills loading silently)
Workaround
Use the absolute path to the plugin directory instead of the package name:
"plugin": ["/Users/<you>/.config/opencode/node_modules/my-plugin"]
This skips the npm install step and loads directly from disk.
Expected behaviour
- If the plugin value is an absolute/relative path, skip npm and load directly.
- If npm install fails, fall back to an existing local copy if present.
- Surface the 404/install failure to the user with a clear error message
rather than "Unknown provider".
Environment
opencode 1.3.13, macOS
Problem
When a plugin listed in
opencode.jsondoes not exist on npm, the plugin loaderfails with a 404 error and silently swallows the plugin —
providers loginthenreturns "Unknown provider" with no actionable message.
The loader unconditionally runs:
opencode add --force --exact --ignore-scripts --cwd ~/.cache/opencode @latest
even when the package is already present in node_modules or when a local path is intended.
Reproduction
~/.config/opencode/node_modules/my-plugin/"plugin": ["my-plugin"]toopencode.jsonopencode providers login --provider <id-registered-by-plugin>Workaround
Use the absolute path to the plugin directory instead of the package name:
This skips the npm install step and loads directly from disk.
Expected behaviour
rather than "Unknown provider".
Environment
opencode 1.3.13, macOS