anomalyco / anomalyco/opencode
[BUG] Global plugin entry pointing under C:\Program Files\... is silently ignored on Windows (no error, no log, no event)
@Hona 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
Description
On Windows, a global plugin entry whose absolute path lives under C:\Program Files\... is never loaded. Nothing is reported anywhere:
- not in
~/.local/share/opencode/log/opencode.log, even with--log-level DEBUG --print-logs - not as an error event on the
GET /eventSSE stream - the TUI/CLI shows nothing
Copying the exact same files to any user-writable path makes the plugin load normally. So the config is valid and the module is valid — the entry is dropped at load time.
Environment
- opencode
1.18.31(installed from npm asopencode-ai, Windows x64 baseline binary) - Windows 11 Pro 25H2, build
26200.8457(kernel10.0.26200), x64 - Global config at
C:\Users\<user>\.config\opencode\opencode.json
Config
{
"$schema": "https://opencode.ai/config.json",
"plugin": [
"C:/Program Files/Clawd on Desk/resources/app.asar.unpacked/hooks/opencode-plugin"
]
}
opencode debug config parses and resolves it correctly:
{
"plugin": [
"file:///C:/Program%20Files/Clawd%20on%20Desk/resources/app.asar.unpacked/hooks/opencode-plugin"
],
"plugin_origins": [
{
"spec": "file:///C:/Program%20Files/Clawd%20on%20Desk/resources/app.asar.unpacked/hooks/opencode-plugin",
"source": "C:\\Users\\<user>\\.config\\opencode",
"scope": "global"
}
]
}
opencode debug info also lists the plugin. So resolution works; the entry is dropped later (in loadExternal, most likely).
Steps to reproduce
- As administrator, create
C:\Program Files\plugtest\index.mjs:
import { appendFileSync } from "node:fs";
export default async () => {
appendFileSync("C:/plugtest-ran.txt", "loaded " + new Date().toISOString() + "\n");
return {};
};
- Point the global config at it:
{ "$schema": "https://opencode.ai/config.json", "plugin": ["C:/Program Files/plugtest"] }
-
Run any session, e.g.
opencode run --print-logs --log-level DEBUG -m <provider/model> "hi". -
C:\plugtest-ran.txtis never created. No mention of the plugin in the logs, no error event. -
Copy the same folder to
C:\plugtest, change the config entry toC:/plugtest, rerun: the marker file is created immediately.
Test matrix (identical plugin files — only the registered path differs)
| Registered plugin path | Loaded? |
|---|---|
C:/Program Files/Clawd on Desk/resources/app.asar.unpacked/hooks/opencode-plugin (directory) |
no |
C:/Program Files/Clawd on Desk/resources/app.asar.unpacked/hooks/opencode-plugin/index.mjs (explicit file) |
no |
C:\clawd-hooks\opencode-plugin (NTFS junction whose target is the Program Files dir) |
no |
C:/Users/<user>/.config/opencode/clawd-hooks/plugin (copy) |
yes |
C:\oc-plugin-test\opencode-plugin (copy, outside the home directory) |
yes |
C:/Users/<user>/asar-test/app.asar.unpacked/hooks/opencode-plugin (copy; app.asar.unpacked in the path) |
yes |
C:/Users/<user>/clawd test/opencode-plugin (copy; space in the path) |
yes |
| trivial control fixture plugin in a writable dir | yes |
Notes:
- Spaces in the path are not the problem (
clawd testworked). app.asar.unpackedin the path is not the problem.- The junction case suggests the check is applied to the resolved real path, not the literal config string.
- Mixing a working entry and the Program Files entry in the same
pluginarray in one run: the working one loads, the Program Files one is skipped, still with no error event.
Impact
Clawd on Desk (a desktop pet / session HUD for CLI agents) ships its opencode plugin inside its installed app directory and registers it globally:
C:/Program Files/Clawd on Desk/resources/app.asar.unpacked/hooks/opencode-plugin
That is the default installation path, so every Clawd user on Windows loses the integration silently after upgrading opencode. Debugging is painful because the only visible symptom is "the plugin never runs" — there is no error to search for.
Requests
- Don't skip silently. Log a
WARN/ERRORfor a dropped plugin entry (thereport.errorcallback in the plugin loader currently only publishes aPlugin.Event.Errorevent), so it shows up inopencode.logand--print-logs. - Surface it in
opencode debug config/opencode debug info— e.g. mark an origin as unresolvable/unsupported instead of listing it as if it were loaded. - Support plugin paths in protected/system directories (very common on Windows for app-shipped plugins). If the loader needs write access to the plugin path (for a lockfile /
node_modulesmaterialization / bundling step), either avoid that requirement or fail loudly.
Additional observation (low confidence)
A plugin entry at a writable path whose entry file only re-exports the real module is also not loaded:
// C:/Users/<user>/.config/opencode/clawd-shim/index.mjs
export { default } from "file:///C:/Program%20Files/Clawd%20on%20Desk/resources/app.asar.unpacked/hooks/opencode-plugin/index.mjs";
Two variants were tried — the absolute file:// specifier above, and a relative one (../../../../Program Files/Clawd on Desk/.../opencode-plugin/index.mjs), each with a sibling package.json ({"type":"module","main":"index.mjs"}). Both load fine under plain Node (import() → { default: [Function] }) and the default export is the plugin factory, but opencode never runs them. This might indicate the loader resolves/bundles the entry's import graph rather than just the entry — worth checking while fixing the above.
Plugins
opencode-family (shipped by Clawd on Desk) — registered as C:/Program Files/Clawd on Desk/resources/app.asar.unpacked/hooks/opencode-plugin
OpenCode version
1.18.31
Steps to reproduce
- As administrator, create
C:\Program Files\plugtest\index.mjs:
import { appendFileSync } from "node:fs";
export default async () => {
appendFileSync("C:/plugtest-ran.txt", "loaded " + new Date().toISOString() + "\n");
return {};
};
- Point the global config at it:
{ "$schema": "https://opencode.ai/config.json", "plugin": ["C:/Program Files/plugtest"] }
-
Run any session, e.g.
opencode run --print-logs --log-level DEBUG -m <provider/model> "hi". -
C:\plugtest-ran.txtis never created. No mention of the plugin in the logs, no error event. -
Copy the same folder to
C:\plugtest, change the config entry toC:/plugtest, rerun: the marker file is created immediately.
Screenshot and/or share link
No response
Operating System
Windows 11 Pro 25H2, build 26200.8457 (kernel 10.0.26200), x64
Terminal
Windows Terminal
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.