Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta Adatta ai principianti
#50,950 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
75/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
bash, shell, typescript
Ambito
cli, tooling

Direzione di ricerca

Esamina il codice del comando di aggiornamento, probabilmente in un modulo CLI, dove viene costruito il percorso dello script di installazione e passato a bash. La correzione prevede la conversione delle barre rovesciate di Windows in barre oblique o in un percorso POSIX prima di avviare bash. Testare eseguendo il processo di aggiornamento su Windows o simulando la conversione del percorso in un test unitario.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
209k
Fork
27.5k
Merge medio
9h 42m
PR unite (30g)
389

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di anomalyco/opencode

Tutte le issue di anomalyco/opencode

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.