Skip to content

updater: windows update dialog runs bash and fails when bash is not installed #50886

Closed

Description

@vibrantzone3-art

Summary

On Windows, the "Update available" dialog attempts to run the Unix install script via bash, so the in-app update always fails with 'bash' is not recognized as an internal or external command on machines without bash in PATH (no Git Bash / WSL).

Environment

  • opencode version: v2.0.15 (bug observed on v2.0.14 before manually updating)
  • OS: Windows_NT 10.0.19045 (win32 x64)
  • Terminal: Unavailable: terminal app not identifiable (TERM=xterm-256color, TERM_PROGRAM unset)
  • Shell: C:\Windows\system32\cmd.exe
  • Install/channel: standalone binary in %USERPROFILE%\.opencode\bin (install.sh-style install), latest channel; an @opencode/cli npm global copy also present
  • Active plugins: none found (no opencode.json(c) in home/config/project, no plugin directories)

Reproduction

  1. Use a Windows machine with no bash in PATH (no Git Bash, no WSL).
  2. Install opencode as a standalone binary in %USERPROFILE%\.opencode\bin.
  3. Launch opencode on a version older than the latest release.
  4. When the "Update available" dialog appears, let it run / accept the update.

Expected Behavior

The updater should use a Windows-native update path (e.g. npm, or a PowerShell/binary download), or detect that bash is unavailable and show a clear manual-update instruction instead of a raw cmd error.

Actual Behavior

The dialog displays the cmd error instead of updating:

'bash' is not recognized as an internal or external command,
operable program or batch file.

The update never happens; this repeats every time a new release is available.

Additional Context

  • The standalone binary lives in %USERPROFILE%\.opencode\bin, which precedes the npm global directory in the user PATH, so the binary install is the one invoked by opencode.
  • Workaround used: download the platform package directly from npm (https://registry.npmjs.org/@opencode/cli-windows-x64/-/cli-windows-x64-<version>.tgz), extract package/bin/opencode.exe, rename the old binary, and copy the new one into %USERPROFILE%\.opencode\bin. This worked.
  • A possible fix direction: detect the install method/OS before spawning the updater, and on Windows without bash fall back to npm or the PowerShell download path.
  • Reproducible consistently whenever an update is available.

Activity

  1. yang0228 commented on Sep 23, 2026

    @yang0228
    Contributor

    I'd like to take this on. Could you assign it to me if no one is already working on it?

    I checked v2: in packages/cli/src/services/updater.ts, method() classifies %USERPROFILE%\.opencode\bin\opencode.exe as curl, and upgrade() then downloads the installer and invokes bash without checking availability.

    For a focused first fix, I'd guard the Windows standalone path and return an actionable UpgradeError with manual-update instructions when bash is missing. I wouldn't silently switch to npm: with the reported PATH ordering, that could update a different installation while leaving the active binary unchanged.

    I'd add regression tests for missing bash, a standalone install alongside npm, and the existing bash/package-manager paths, then open a small PR against v2. If you'd prefer a native standalone updater rather than the manual fallback allowed by the expected behavior, I'm happy to align on that scope first.

  2. neriousy commented on Oct 20, 2026

    @neriousy
    Member

    Thanks for the report! Since 2.0.23, Windows standalone updates locate Git Bash explicitly and, when it is missing, explain how to install Git for Windows or set OPENCODE_GIT_BASH_PATH rather than failing with the raw cmd error. Update with opencode upgrade or npm i -g @opencode/cli@latest (desktop: update the app). Please comment or reopen if this still happens on that version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions