Bug: file:// plugins with same filename incorrectly deduplicated #6352

Open
opened 2026-02-16 18:03:26 -05:00 by yindo · 0 comments
Owner

Originally created by @coleleavitt on GitHub (Jan 15, 2026).

Originally assigned to: @rekram1-node on GitHub.

Bug Description

Multiple file:// plugins with the same entry point filename (e.g., index.js) are incorrectly treated as duplicates during plugin loading, causing only the last one to load.

Steps to Reproduce

  1. Create a config with multiple file:// plugins using standard entry points:
{
  "plugin": [
    "file:///path/to/plugin-a/dist/index.js",
    "file:///path/to/plugin-b/dist/index.js",
    "file:///path/to/plugin-c/dist/index.js"
  ]
}
  1. Start OpenCode with debug logging:
OPENCODE_LOG_LEVEL=DEBUG opencode run "test" 2>&1 | grep "loading plugin"
  1. Observe that only the last plugin loads

Expected Behavior

All three plugins should load since they have different paths.

Actual Behavior

Only plugin-c loads. The deduplication logic in getPluginName() extracts only the filename ("index") for all three plugins, marking them as duplicates.

Root Cause

In packages/opencode/src/config/config.ts, the getPluginName() function extracts only the filename for file:// URLs:

if (plugin.startsWith("file://")) {
  return path.parse(new URL(plugin).pathname).name  // Returns "index" for all
}

This was designed for npm package deduplication but doesn't account for file:// plugins where:

  • Multiple plugins may use the same filename (standard practice: index.js)
  • Plugins in different directories should not be considered duplicates
  • Even plugins in the same directory with different filenames should be allowed

Impact

  • Users cannot use multiple local plugins with standard entry point names
  • No warning is shown when plugins are silently dropped
  • Workaround requires renaming entry points to unique names (non-standard)

Environment

  • OpenCode version: 1.1.23
  • Node/Bun version: Bun 1.3.5
  • OS: Linux

Related

This affects anyone using local plugin development with standard JavaScript conventions.

Originally created by @coleleavitt on GitHub (Jan 15, 2026). Originally assigned to: @rekram1-node on GitHub. ## Bug Description Multiple file:// plugins with the same entry point filename (e.g., `index.js`) are incorrectly treated as duplicates during plugin loading, causing only the last one to load. ## Steps to Reproduce 1. Create a config with multiple file:// plugins using standard entry points: ```jsonc { "plugin": [ "file:///path/to/plugin-a/dist/index.js", "file:///path/to/plugin-b/dist/index.js", "file:///path/to/plugin-c/dist/index.js" ] } ``` 2. Start OpenCode with debug logging: ```bash OPENCODE_LOG_LEVEL=DEBUG opencode run "test" 2>&1 | grep "loading plugin" ``` 3. Observe that only the last plugin loads ## Expected Behavior All three plugins should load since they have different paths. ## Actual Behavior Only `plugin-c` loads. The deduplication logic in `getPluginName()` extracts only the filename ("index") for all three plugins, marking them as duplicates. ## Root Cause In `packages/opencode/src/config/config.ts`, the `getPluginName()` function extracts only the filename for file:// URLs: ```typescript if (plugin.startsWith("file://")) { return path.parse(new URL(plugin).pathname).name // Returns "index" for all } ``` This was designed for npm package deduplication but doesn't account for file:// plugins where: - Multiple plugins may use the same filename (standard practice: `index.js`) - Plugins in different directories should not be considered duplicates - Even plugins in the same directory with different filenames should be allowed ## Impact - Users cannot use multiple local plugins with standard entry point names - No warning is shown when plugins are silently dropped - Workaround requires renaming entry points to unique names (non-standard) ## Environment - OpenCode version: 1.1.23 - Node/Bun version: Bun 1.3.5 - OS: Linux ## Related This affects anyone using local plugin development with standard JavaScript conventions.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#6352