anomalyco / anomalyco/opencode

[Windows] "Open in → PowerShell" fails with CommandNotFoundException (open-path runs the directory as a command)

Open
#40,277 3 comments 0 reactions 1 assignee View on GitHub

@Hona is already working on this.

Since Aug 3, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

Clicking "Open in → PowerShell" in the session header dropdown of OpenCode Desktop on Windows fails with an error toast:

Error invoking remote method 'open-path': Error: Command failed:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
D:\path\to\project
D:\path\to\project : The term 'D:\path\to\project' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. (CommandNotFoundException)

Root cause (from reading the packaged code): the renderer's Windows "Open in" menu passes openWith: "powershell", which calls platform.openPath(directory, "powershell"). The main-process handler then runs:

execFile("powershell", [path]) // = powershell.exe D:\path\to\project

PowerShell treats the positional argument as a script/command to execute, not a directory to open, so it fails with CommandNotFoundException. This affects any shell (verified with both Windows PowerShell 5.1 and PowerShell 7 / pwsh), so it is broken by design of the open-path handler, not environment-specific.

Expected: "Open in → PowerShell" should open a PowerShell session in the project directory, e.g. spawn powershell/pwsh with -NoExit -WorkingDirectory , or reuse the node-pty shell spawn the app already uses for its built-in terminal panel (which works correctly).

Plugins

None

OpenCode version

OpenCode Desktop 1.18.11 (bundled opencode sidecar)

Steps to reproduce
  1. Open OpenCode Desktop on Windows and open any project folder
  2. In the session header, click the "Open in" dropdown
  3. Select "PowerShell"
  4. An error toast appears: CommandNotFoundException - the project directory is executed as a command
Screenshot and/or share link
Image
Operating System

Windows 11

Terminal

OpenCode Desktop built-in terminal panel / Windows Terminal

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.