Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

cli: upgrade on Windows fails because the install script path is passed to bash with backslashes

Open Beginner friendly
#50,950 0 comments 0 reactions 0 assignees View on GitHub

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
Domain
cli, tooling

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), channel latest, binary at %USERPROFILE%\.opencode\bin\opencode.exe
  • Active plugins: none

Reproduction

  1. On Windows, install OpenCode V2 with the curl installer so the binary lives at %USERPROFILE%\.opencode\bin\opencode.exe.
  2. Have any version that is not the latest (e.g. 2.0.12).
  3. Run opencode upgrade (or accept the "Update available" dialog in the TUI).
  4. 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:

  1. Download https://opencode.ai/files/bin/<version>/opencode-windows-x64.zip.
  2. Extract opencode.exe.
  3. Rename the currently running opencode.exe to opencode.exe.bak (Windows permits renaming a running executable but not overwriting it).
  4. Copy the new opencode.exe into %USERPROFILE%\.opencode\bin\.
  5. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from anomalyco/opencode

All issues in anomalyco/opencode

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.