cli: upgrade on Windows fails because the install script path is passed to bash with backslashes
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 75/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- bash, shell, typescript
Research direction
Look at the upgrade command's code, likely in a CLI module, where the install script path is constructed and passed to bash. The fix involves converting Windows backslashes to forward slashes or a POSIX path before spawning bash. Test by running the upgrade process on Windows or simulating the path conversion in a unit test.
Written by the indexing model from the issue text.
Description
Summary
On Windows, opencode upgrade (and the TUI "Update available" dialog, which uses the same path) always fails because the downloaded install script is invoked via bash with a native Windows path. Bash treats the backslashes as escape characters, so the file is never found. Updating is impossible without doing it manually.
Environment
- opencode version: 2.0.15 (reproduced upgrading 2.0.12 → 2.0.14 and 2.0.14 → 2.0.15)
- OS: Windows 11 Pro, build 26200 (Windows_NT 10.0.26200, x64)
- Terminal: reproduced from both the TUI and a plain
cmd.exe/ PowerShell shell, so it is terminal-independent - Shell:
C:\WINDOWS\system32\cmd.exe - Install/channel: curl installer (
curl -fsSL https://opencode.ai/v2/install | bash), channellatest, binary at%USERPROFILE%\.opencode\bin\opencode.exe - Active plugins: none
Reproduction
- On Windows, install OpenCode V2 with the curl installer so the binary lives at
%USERPROFILE%\.opencode\bin\opencode.exe. - Have any version that is not the latest (e.g. 2.0.12).
- Run
opencode upgrade(or accept the "Update available" dialog in the TUI). - The updater downloads the install script successfully, then fails to execute it.
Expected Behavior
OpenCode updates to the latest version.
Actual Behavior
╭ Upgrade
│
● Using method: curl
│
● From 2.0.12 → 2.0.14
│
■ Upgrade failed
│
■ /bin/bash: C:\Users\gomez\.cache\opencode\update-nikDwW\install: No such file or directory
│
╰ Failed
The same error appears in the TUI "Update available" dialog. opencode upgrade --method curl fails identically.
Additional Context
Log evidence (~/.local/share/opencode/log/opencode.log), showing the spawn of the install script:
message="spawning process" command=curl args="[\"-fsSL\",\"-o\",\"C:\\\\Users\\\\gomez\\\\.cache\\\\opencode\\\\update-H7ycBJ\\\\install\",\"https://opencode.ai/v2/install\"]" role=cli
message="spawning process" command=bash args="[\"C:\\\\Users\\\\gomez\\\\.cache\\\\opencode\\\\update-H7ycBJ\\\\install\",\"--version\",\"2.0.15\",\"--no-modify-path\"]" role=cli
Root cause
The install script path is passed to bash as a native Windows path:
bash "C:\Users\gomez\.cache\opencode\update-H7ycBJ\install" --version 2.0.15 --no-modify-path
Bash interprets the backslashes as escape characters, so the argument collapses to a single token like C:Usersgomez.cacheopencodeupdate-H7ycBJinstall, which does not exist. The download itself succeeds; only the invocation is wrong.
Suggested fix directions (one of):
- Convert the script path to a POSIX path before spawning bash (e.g.
/c/Users/gomez/.cache/opencode/update-H7ycBJ/install), or - Pass the path with forward slashes, or
- On Windows, invoke the script through a shell that understands Windows paths (Git Bash with a converted path), or
- Skip the shell-script route entirely on Windows and use the standalone zip (
https://opencode.ai/files/bin/<version>/opencode-windows-x64.zip) directly.
Frequency
Consistent — 100% reproducible across three attempts and two different version pairs.
Workaround used
Manual update, which works reliably:
- Download
https://opencode.ai/files/bin/<version>/opencode-windows-x64.zip. - Extract
opencode.exe. - Rename the currently running
opencode.exetoopencode.exe.bak(Windows permits renaming a running executable but not overwriting it). - Copy the new
opencode.exeinto%USERPROFILE%\.opencode\bin\. - Restart OpenCode.
Note: step 3 is necessary because a plain overwrite of the running binary fails on Windows, which may be a second issue to consider for the Windows update path.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- Avg merge
- 9h 42m
- Merged PRs (30d)
- 389
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from anomalyco/opencode
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
All issues in anomalyco/opencode
Similar issues
-
bug(cli): hapi doctor inline-media prints a fabricated B:\ helper-script path in packaged installs Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Crush Open
Difficulty 1/5 Under an hour Newbie friendliness 85/100
catppuccin/catppuccin#3125 ·
-
Add a SECURITY.md Open
Difficulty 1/5 Under an hour Newbie friendliness 90/100
ElementsProject/cln-application#167 · 1 comment · 1 reaction ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Quantco/pnpm-licenses#17 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100