Skip to content

opencode v1.18.x fails to load plugin: parseCommandFile named export mistaken for plugin factory #631

Description

@ARareUsername

Bug

opencode v1's plugin loader has a getLegacyPlugins() function that iterates all exported values from a plugin module and treats every function as a plugin factory. When parseCommandFile is a named export, the loader calls it with a PluginInput object — but parseCommandFile expects a file path string and calls fs.readFileSync(PluginInput, 'utf8'), which throws:

ERROR failed to load plugin path=@dietrichgebert/ponytail error="path must be a string or a file descriptor"

Fix

Remove the export keyword from parseCommandFile in .opencode/plugins/ponytail.mjs — it's only used internally and shouldn't be a named export.

- export function parseCommandFile(filePath) {
+ function parseCommandFile(filePath) {

Impact

Plugin fails to load on opencode v1.18.4 (and likely any v1.x using getLegacyPlugins). The error is silent to the user (no UI notification), only visible in server logs with --log-level DEBUG.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions