cursor-acp fails to load: @opencode-ai/plugin ESM import missing .js extension
Summary
cursor-acp fails to load in OpenCode on macOS because the installed @opencode-ai/plugin dependency emits extensionless relative ESM imports.
This prevents the local Cursor ACP proxy from starting on 127.0.0.1:32124, which then causes ECONNREFUSED when selecting cursor-acp/* models.
Environment
- macOS arm64
- OpenCode:
1.15.11 @rama_nigg/open-cursor:2.4.6- Installed via the one-line installer / global npm package
- Cursor Agent: installed and
cursor-agent modelsworks
Error
OpenCode desktop logs repeatedly showed plugin load failures like:
Cannot find module '/opt/homebrew/lib/node_modules/@rama_nigg/open-cursor/node_modules/@opencode-ai/plugin/dist/tool' imported from /opt/homebrew/lib/node_modules/@rama_nigg/open-cursor/node_modules/@opencode-ai/plugin/dist/index.js
failed to load plugin
Direct reproduction:
node -e "import('/opt/homebrew/lib/node_modules/@rama_nigg/open-cursor/dist/plugin-entry.js').then(()=>console.log('import ok')).catch(e=>{console.error(e.message); process.exit(1)})"
Before patch, that prints the same Cannot find module .../dist/tool error.
Root cause
The package is ESM ("type": "module"), but the bundled dependency file contains extensionless relative imports:
// node_modules/@opencode-ai/plugin/dist/index.js
export * from "./tool";
The file exists as tool.js, but Node/Electron ESM resolution does not add .js for relative imports.
example.js has the same pattern:
import { tool } from "./tool";
Local workaround that fixed it
Patching the installed dependency to include .js fixed plugin import and Cursor ACP runtime:
// node_modules/@opencode-ai/plugin/dist/index.js
-export * from "./tool";
+export * from "./tool.js";
// node_modules/@opencode-ai/plugin/dist/example.js
-import { tool } from "./tool";
+import { tool } from "./tool.js";
After patch:
node -e "import('/opt/homebrew/lib/node_modules/@rama_nigg/open-cursor/dist/plugin-entry.js').then(()=>console.log('import ok')).catch(e=>{console.error(e.stack||e.message); process.exit(1)})"
prints:
import ok
Then:
opencode models cursor-acp
opencode run "Reply exactly: CURSOR_ACP_FIXED" -m cursor-acp/composer-2.5-fast
both work. The run returned the expected CURSOR_ACP_FIXED response.
Impact
- Repeated OpenCode desktop/sidebar error notifications during project/dashboard initialization.
- Cursor ACP proxy does not start.
- Selecting
cursor-acp/*models fails with connection refused to127.0.0.1:32124.
Suggested fix
Either:
- publish/fix
@opencode-ai/pluginso its ESM output uses explicit.jsextensions for relative imports, or - make
open-cursoravoid shipping/depending on a broken ESM runtime import path, or - bundle the required plugin helper code so the dependency import cannot fail at runtime.
The local patch above is not durable because npm update -g @rama_nigg/open-cursor or reinstalling can overwrite it.
Observed behavior on MacOS / OpenCode Desktop App (1.15.10)
Fixed in v2.4.8 via PR #89 — the plugin now imports @opencode-ai/plugin/dist/tool.js with the correct .js extension instead of the broken extensionless root import.
If you still see plugin load failures on >= 2.4.8, please reopen with your OpenCode version, install method, and the exact error from the logs.
Great! Thank you.