Skip to content

Failed to load plugin file:///real/path/to/plugins/my-plugin.js: Cannot find module '@opencode-ai/plugin' #23553

Closed as not planned

Description

@badloop

Description

Root cause

In config/plugin.ts, the Glob.scan call uses follow: true (via symlink: true), and absolute: true. The glob library resolves through symlinks and returns the real path of matched files. This real path is then converted to a file:// URL and passed to import().
When Bun (or Node) imports from the real path, it resolves @opencode-ai/plugin relative to the real directory — not the symlink location where node_modules actually exists.

Reproduction

  1. Create plugins in a separate directory (e.g. /some/other/path/plugins/)
  2. Symlink ~/.config/opencode/plugins to that directory
  3. Ensure the plugin imports from @opencode-ai/plugin
  4. Have a package.json in ~/.config/opencode/ with @opencode-ai/plugin as a dependency
  5. Start opencode — plugin fails to load

Expected behavior

Plugins discovered through symlinked directories should resolve dependencies from the config directory's node_modules, not from the symlink target's directory tree.

Suggested fix

Pass realpath: false to the glob options in config/plugin.ts (and possibly tool/registry.ts which has the same pattern for custom tools), so that returned paths preserve the symlink path rather than resolving to the real path.

Plugins

No response

OpenCode version

1.14.18

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

Arch Linux (btw)

Terminal

Kitty 0.46.2

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Apr 20, 2026
  2. github-actions commented on Apr 20, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If your issue is not fully addressed by those, please add a comment explaining what's different so it can be kept open.

  3. removed
    bugSomething isn't working
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  4. github-actions commented on Jul 4, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions