Skip to content

Background "npm install @opencode-ai/plugin@local" fails on every project dir — OPENCODE_VERSION not injected in packaged build (Desktop v1.18.1) #37806

Description

@sergiofspedro

Description

Every project directory OpenCode scans triggers a background npm install @opencode-ai/plugin@<version>
(intended to make the plugin SDK available for that project's local .opencode/ agents/commands).
On the packaged Desktop build (v1.18.1, Windows), this always fails with:

NpmInstallFailedError: @opencode-ai/plugin: No matching version found for @opencode-ai/plugin@local

Root cause (traced in app.asar)

InstallationVersion = typeof OPENCODE_VERSION === "string" ? OPENCODE_VERSION : "local";
InstallationChannel = "prod";
InstallationLocal = InstallationChannel === "local"; // always false in this build
...
version: InstallationLocal ? undefined : InstallationVersion

OPENCODE_VERSION is meant to be substituted with a real version string at build time, but isn't in
this build — it falls through to the literal string "local", which isn't a valid npm dist-tag, so the
install 404s every time.

Impact

Cosmetic but noisy: fires as a logWarning, not a thrown error, so it doesn't block config/plugin
loading — but it repeats for every open project directory on every restart (13+ times in one session
across 5 project dirs), and appears to be one of the triggers for the generic
"Session error / An error occurred" toast (notification.session.error.fallbackDescription), since
that's the app's catch-all for any unhandled session-level error.

Workaround attempted (didn't work)

Pre-seeded a package.json in the affected directory with @opencode-ai/plugin pinned to a real,
already-installed version (1.17.3), hoping the installer would see it as already satisfied. It still
failed identically — the install call appears to run unconditionally rather than checking the existing
package.json first.

Fix

Ensure OPENCODE_VERSION is properly injected as the real app version string at build time for the
packaged Desktop release, instead of falling through to the "local" placeholder.

Environment

  • OpenCode Desktop 1.18.1, Windows

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

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