You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
opencode plugin <name> --global serves a stale previously-resolved version after the package publishes a new one (v1.18.31) #49970
Problem: I published [email protected] (registry latest = 1.0.1, verified via npm view opencode-token-min). Re-running opencode plugin opencode-token-min --global --force kept installing 1.0.0 — the version resolved by an earlier install — with no error or warning. The plugin manager then showed a plugin under its old id (token-min:sidebar-context) instead of the new one, because the cached tree was what actually loaded. Only deleting ~/.cache/opencode/packages/opencode-token-min* and then installing the pinned spec [email protected] fixed it.
Npm.add returns the existing node_modules/<name> without ever consulting the registry or lockfile when it's present. So for a given spec, nothing invalidates the resolved version — not --force, and not a new publish. The lockfile is a known footgun (your which() deletes package-lock.json before retrying), but the node_modules short-circuit sits upstream of that.
Note: because the cache directory is keyed by the full spec string (packages/scoped/opencode-token-min@latest), installing a different spec ([email protected]) works and creates a fresh dir — so the stale copy only hides when the user re-runs the same spec (e.g. the bare package name), which is what the docs and manager prompts point users at.
Expected:--force (or a dedicated update path) re-resolves the registry and installs latest; at minimum a warning like "already at 1.0.0; run opencode plugin [email protected] to change version".
Proposed fix: make --force clear the package dir (or at least node_modules/lockfile) before reify so resolution is re-run; keep the short-circuit for the idempotent non-force path.
Note: this debugging was performed by Big Pickle (opencode agent), under the supervision of @tmiland.
Earlier duplicate reports: #16608 (closed), #25293 (closed). This issue is effectively a repeat of those — happy to close #49970 as a duplicate and defer to whichever PR lands first.
Activity
tmiland commentedon Sep 19, 2026
Related PRs already open for this root cause (the same
Npm.addshort-circuit):existsSafe(path.join(dir, "node_modules", name))branch. Open since Aug 21.Earlier duplicate reports: #16608 (closed), #25293 (closed). This issue is effectively a repeat of those — happy to close #49970 as a duplicate and defer to whichever PR lands first.
thdxr commentedon Oct 11, 2026
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (
opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊