Skip to content

fix: Plugin paths displayed incorrectly on Windows #16559

@abc-lee

Description

@abc-lee

Bug Description

On Windows, plugin paths are displayed incorrectly in the UI. Instead of showing the plugin name (e.g., oh-my-opencode), the full filesystem path is shown (e.g., C:\Users\Username\ or E:\opencode\).

Root Cause

In packages/opencode/src/config/config.ts line 1250:

data.plugin[i] = import.meta.resolve!(plugin, options.path)

On Windows, import.meta.resolve() returns a raw filesystem path like E:\path\to\plugin\index.js instead of a file:// URL. This causes:

  1. getPluginName() fails to extract the plugin name (it checks for file:// prefix)
  2. The raw path is displayed directly in the UI

Note: The fallback require.resolve() path correctly uses pathToFileURL() on line 1256.

Expected Behavior

Plugin list should show plugin names like oh-my-opencode @latest.

Actual Behavior

Plugin list shows raw paths like C:\Users\Username\ or E:\opencode\.

Environment

  • Windows 10/11
  • OpenCode v1.2.21

Suggested Fix

Convert the resolved path to a file:// URL consistently:

const resolved = import.meta.resolve!(plugin, options.path)
data.plugin[i] = resolved.startsWith("file://") ? resolved : pathToFileURL(resolved).href

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)windows

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions