[PR #8462] fix: validate version exists before upgrade #12749

Open
opened 2026-02-16 18:17:38 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/8462

State: open
Merged: No


Summary

Fixes #8422

When upgrading to a specific version with opencode upgrade <version>, the command now validates that the version exists before attempting the upgrade. Previously, the command would always report "Upgrade complete" even when specifying non-existent versions like 1.1.1534543 or 0.0.0.

Changes

  • Added versionExists() function to Installation namespace to check if a version is available
  • Modified upgrade command to validate the target version before proceeding
  • Added clear error messages when version is not found:
    • For brew: Explains that only the latest version is available
    • For npm/pnpm/bun: Reports that the version was not found
    • For curl: Checks GitHub releases for the version

Before

$ opencode upgrade 1.1.1534543
┌  Upgrade
│
●  Using method: brew
│
●  From 1.1.10 → 1.1.1534543
│
◇  Upgrade complete   ← FALSE SUCCESS
│
└  Done

After

$ opencode upgrade 1.1.1534543
┌  Upgrade
│
●  Using method: brew
│
◇  Checking version availability...
│
✖  Version not found
│
▲  Version 1.1.1534543 is not available via brew. Only the latest version can be installed.
│
●  Available version: 1.1.20
│
└  Done

🤖 Generated with Claude Code

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/8462 **State:** open **Merged:** No --- ## Summary Fixes #8422 When upgrading to a specific version with `opencode upgrade <version>`, the command now validates that the version exists before attempting the upgrade. Previously, the command would always report "Upgrade complete" even when specifying non-existent versions like `1.1.1534543` or `0.0.0`. ## Changes - Added `versionExists()` function to `Installation` namespace to check if a version is available - Modified upgrade command to validate the target version before proceeding - Added clear error messages when version is not found: - For brew: Explains that only the latest version is available - For npm/pnpm/bun: Reports that the version was not found - For curl: Checks GitHub releases for the version ## Before ``` $ opencode upgrade 1.1.1534543 ┌ Upgrade │ ● Using method: brew │ ● From 1.1.10 → 1.1.1534543 │ ◇ Upgrade complete ← FALSE SUCCESS │ └ Done ``` ## After ``` $ opencode upgrade 1.1.1534543 ┌ Upgrade │ ● Using method: brew │ ◇ Checking version availability... │ ✖ Version not found │ ▲ Version 1.1.1534543 is not available via brew. Only the latest version can be installed. │ ● Available version: 1.1.20 │ └ Done ``` --- 🤖 Generated with Claude Code
yindo added the pull-request label 2026-02-16 18:17:38 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12749