Skip to content

fix: handle 'latest' version string in plugin semver check#20714

Closed
AmanKRoy wants to merge 1 commit into
anomalyco:devfrom
AmanKRoy:fix/plugin-version-latest
Closed

fix: handle 'latest' version string in plugin semver check#20714
AmanKRoy wants to merge 1 commit into
anomalyco:devfrom
AmanKRoy:fix/plugin-version-latest

Conversation

@AmanKRoy

@AmanKRoy AmanKRoy commented Apr 2, 2026

Copy link
Copy Markdown

Problem

When a plugin is specified without a version (e.g., my-plugin instead of my-plugin@1.0.0), opencode defaults the version to the string "latest". The Npm.outdated() function then calls semver.lt("latest", ...), which throws because "latest" is not a valid SemVer string.

This matches issue #12143.

Fix

Added an early return in Npm.outdated() that skips the version check when cachedVersion === "latest".

Testing

  • Verified that plugins without a version no longer cause crashes
  • Verified that plugins with explicit versions still update correctly

Fixes #12143

When a plugin is installed without specifying a version, the cached
version is 'latest'. semver.lt() throws 'Invalid Version: latest' when
comparing it. Return false immediately since 'latest' always resolves
to the latest version and is never outdated.
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Apr 2, 2026
@github-actions

github-actions Bot commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

github-actions Bot commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potential duplicate PR found:

Why it's related: This PR addresses the same issue of handling non-SemVer version strings (like 'latest') in the plugin installer's version checking logic. Both PRs appear to fix the same root cause - preventing crashes when plugin versions don't conform to valid SemVer format.

@AmanKRoy

AmanKRoy commented Apr 2, 2026

Copy link
Copy Markdown
Author

Duplicate of PR #12265 which addresses the same issue (#12143). Closing in favor of the existing PR.

@AmanKRoy AmanKRoy closed this Apr 2, 2026
@AmanKRoy
AmanKRoy deleted the fix/plugin-version-latest branch April 5, 2026 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs:compliance This means the issue will auto-close after 2 hours.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant