Repository navigation
Description
Description
Note: this is a duplicate of #34734 which was closed for inactivity. I'm reopening it because the bug still exists.
Description
opencode upgrade incorrectly detects scoop as the installation method when opencode is installed via npm but Node.js itself is installed via scoop.
Environment
- OS: Windows 11
- opencode version: 1.18.25
- Installation method:
npm install -g opencode-ai - Node.js installation: via scoop (
scoop install nodejs-lts)
Root Cause
Two compounding issues in packages/opencode/src/installation/index.ts:
1. Exec path sort puts scoop first
The detection sorts package managers by whether their name appears in process.execPath. Because Node.js is installed via scoop, the opencode binary resolves to a path like:
C:\Users\<user>\scoop\apps\nodejs-lts\current\bin\node_modules\opencode-ai\bin\opencode.exe
This path contains scoop, so scoop is sorted to the front of the check list before npm.
2. scoop list opencode always outputs "opencode" in its header
scoop list opencode returns the following even when opencode is not installed via scoop:
Installed apps matching 'opencode':
The detection code checks output.includes("opencode"), which matches this header string regardless of whether any packages are listed. This causes a false positive: scoop is returned as the detected method even though opencode is not managed by scoop.
// In method():
const output = yield* check.command() // scoop list opencode
const installedName = check.name === "scoop" ? "opencode" : "opencode-ai"
if (output.includes(installedName)) { // always true due to header line
return check.name // incorrectly returns "scoop"
}Verification
$ scoop list opencode
Installed apps matching 'opencode':
# (no entries - scoop does NOT manage opencode)
$ npm list -g --depth=0 | grep opencode
+-- [email protected]
# npm IS managing opencodeExpected Behavior
opencode should detect npm as the installation method.
Actual Behavior
opencode upgrade attempts to upgrade via scoop (scoop install opencode@<version>) instead of npm (npm install -g opencode-ai@<version>).
Suggested Fix
For the scoop check, skip the header line before testing for a match:
// scoop list always emits: "Installed apps matching 'opencode':"
// filter that header out before checking for actual results
const lines = output.split("\n").filter(l => !l.startsWith("Installed apps matching"))
if (lines.some(l => l.includes("opencode"))) return "scoop"Alternatively, prefer npm over scoop when npm list -g confirms opencode-ai is installed — a package named opencode-ai can only come from npm, not scoop.
Plugins
No response
OpenCode version
1.18.25
Steps to reproduce
- Install scoop https://scoop.sh/#/
- Install node.js using scoop:
scoop install main/nodejs-lts - Install opencode using npm:
npm install -g opencode-ai - Wait for an update to be available and try
opencode upgrade
Screenshot and/or share link
No response
Operating System
Windows 11
Terminal
Windows terminal
Activity
MilkyWay008 commentedon Sep 1, 2026
The
opencode upgradescoop-vs-npm mixup is the install-detection code, your exec path sits underC:\Users\...\scoop\so the scoop branch wins the sort, andscoop list opencodealways prints that 'Installed apps matching' header, which is why the includes check never catches it. Workaround until it's patched: skip the built-in updater and runnpm install -g opencode-ai@<version>yourself, or patch installation/index.ts to prefer npm whenevernpm list -g --depth=0shows opencode-ai. Fixed the same mess on my Windows box that way.ogerardin commentedon Sep 1, 2026
Thank you, that's exactly what I explained above :)
opencode upgrade -m npmworks too, but it's annoying.Could you elaborate please?
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 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊