Skip to content

[Bug] Render plugin fails to load on OpenCode V2 — add V1/V2 compatibility #4

Open

Description

@gonaik

Summary

The official Render OpenCode plugin fails to load under OpenCode V2.1.4 because the generated plugins/render.ts uses the legacy OpenCode V1 plugin API.

Reinstalling the plugin using the latest official GitHub installer does not resolve the issue.

The Render MCP server works correctly, but the OpenCode plugin itself fails to initialize.

Environment

  • OS: Windows 11
  • OpenCode version: 2.1.4
  • Installation method: Official GitHub install.sh
  • Plugin file: .opencode/plugins/render.ts
  • Source: render-oss/render-opencode-plugin (main)

Steps to reproduce

  1. Install OpenCode V2.1.4.

  2. Install the Render plugin using the official installer:

    curl -fsSL https://raw.githubusercontent.com/render-oss/render-opencode-plugin/main/install.sh | bash
  3. Restart OpenCode.

  4. Run opencode plugin list.

  5. Check the OpenCode server logs.

Actual behavior

The Render plugin appears in the plugin list without a registered plugin ID.

OpenCode reports:

PluginModule.LoadError:
Plugin must export a default definition
with an id and an effect or setup function.

SchemaError:
Expected object at ["default"]

The plugin does not initialize, so its dedicated Blueprint validation tool and automatic validation hooks are unavailable.

Expected behavior

The Render plugin should load successfully under OpenCode V2 and register its validation tool and hooks without errors.

Ideally, the installer should support both OpenCode V1 and V2, either through a dual-compatible plugin definition or version-aware generated plugin files.

Suspected root cause

The generated assets/opencode/plugins/render.ts exports a legacy V1-style plugin function:

var RenderPlugin = async ({ client, directory }) => {
  // ...
  return {
    tool: {
      // ...
    },
    "tool.execute.after": async (input, output) => {
      // ...
    }
  };
};

OpenCode V2 requires a different plugin contract, with a default-exported definition object containing an id and an effect() or setup() method.

Consequently, the current installer generates a plugin that OpenCode V2 rejects.

Suggested solution

  1. Add native OpenCode V2 support while preserving V1 compatibility.
  2. Detect the installed OpenCode major version during installation if separate plugin implementations are required.
  3. Adapt tool registration and automatic Blueprint validation hooks to the V2 API.
  4. Update the generated render.ts through the repository's build process.
  5. Add OpenCode V2 to CI integration testing alongside the existing V1 test matrix.
  6. Document V1/V2 compatibility and any installation differences.

Related work

PR #3 — #3

PR #3 fixed several plugin-loading and installation issues, but its integration tests covered OpenCode 1.15.11 and 1.18.35 rather than V2.

Additional notes

The Render MCP server connects successfully under OpenCode V2.1.4, so the problem appears isolated to the OpenCode plugin interface rather than Render authentication or MCP connectivity.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    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