Skip to content

Plugin without version defaults to "latest" causing semver parsing error #12143

@bdwelle

Description

@bdwelle

Bug Description

When a plugin is specified in opencode.json without a version suffix (e.g., \"opencode-gemini-auth\" instead of \"opencode-gemini-auth@1.3.8\"), opencode defaults the version to the string \"latest\". However, this causes a semver parsing error because \"latest\" is not a valid SemVer string.

Location

File: packages/opencode/src/plugin/index.ts
Lines: 57-58

const lastAtIndex = plugin.lastIndexOf(\"@\")
const version = lastAtIndex > 0 ? plugin.substring(lastAtIndex + 1) : \"latest\"

Error Message

{
  \"name\": \"UnknownError\",
  \"data\": {
    \"message\": \"Error: Invalid SemVer: latest\\n\\n    at order (unknown)\\n    at isOutdated (src/bun/registry.ts:46:19)\\n    at processTicksAndRejections (native:7:39)\"
  }
}

Reproduction Steps

  1. Edit ~/.config/opencode/opencode.json
  2. Specify a plugin without version:
    {
      \"plugin\": [
        \"opencode-gemini-auth\"  // Missing @version
      ]
    }
  3. Run opencode
  4. Error occurs on startup

Expected Behavior

Either:

  1. Skip/ignore plugins without explicit versions
  2. Use a fallback that doesn't require semver parsing
  3. Validate versions before passing to semver and fail with a clear error message

Actual Behavior

Defaults version to \"latest\" string, which causes semver to fail with \"Invalid SemVer: latest\"

Root Cause

The code unconditionally defaults to \"latest\" when no version is found. This string is then passed to semver for version comparison, but semver requires valid SemVer format (e.g., 1.2.3, latest is not valid).

Workaround

Specify explicit version:

{
  \"plugin\": [
    \"opencode-gemini-auth@1.3.8\"
  ]
}

Notes

This can occur when third-party tools (e.g., tessl/skills installers) rewrite the config and strip version specifiers.

Metadata

Metadata

Assignees

Labels

No labels
No labels

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