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), channel latest, 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.exe to opencode.exe.bak (Windows permits renaming a running executable but not overwriting it).
- Copy the new
opencode.exe into %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.