You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Windows] "Open in → PowerShell" fails with CommandNotFoundException (open-path runs the directory as a command) #40277
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:
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).
Still reproduces on OpenCode Desktop 1.18.29 / Windows 11 (PowerShell 5.1)
Environment:
OpenCode Desktop: 1.18.29
OS: Windows 11 x64 (build 26100)
Shell: Windows PowerShell 5.1 (5.1.26100.9168) — also fails when selecting PowerShell 7 (pwsh)
Same Error invoking remote method 'open-path' dialog when choosing "Open in → PowerShell" from the top-right dropdown. The invoked command matches the reported root cause — the project path is passed as a positional argument:
Additional observation: on a Japanese-locale Windows, the error message inside the dialog is garbled (mojibake) — the localized CommandNotFoundException text is rendered with wrong encoding, which may be worth handling in the fix for readability.
Hope the PR #46712 lands soon. Happy to test a nightly build if needed.
and fails with CommandNotFoundException (CategoryInfo: ObjectNotFound), because the working directory is passed as a positional argument and PowerShell executes it as a command.
Confirmed at the code level - in the packaged resources\app.asar / out\main\index.js (v1.18.32):
ipcMain.handle("open-path",async(_event,path,app2)=>{if(!app2)returnshell.openPath(path);awaitnewPromise((resolve2,reject)=>{const[cmd,args]=process.platform==="darwin"
? ["open",["-a",app2,path]]
: [app2,[path]];// <- path passed as the sole argv[1]execFile(cmd,args,(err)=>err ? reject(err) : resolve2());});});
The renderer's Windows menu entry is openWith: "powershell", so this resolves to execFile("C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe", [path]).
I verified the exact failure by running the same command directly:
This is broken on Windows by design of the open-path handler, independent of shell version (affects both Windows PowerShell 5.1 and pwsh 7).
Note: A fix PR is already open and awaiting review/merge: #46712 (cmd /d /c start + -EncodedCommand/Set-Location -LiteralPath). Happy to retest once it lands.
Activity
github-actions commentedon Aug 3, 2026
This issue might be a duplicate of existing issues. Please check:
These issues describe the same root cause and symptoms. Please review them and consider adding any additional context there instead.
hokonoko commentedon Sep 2, 2026
Opened a PR for this: #46712 — verified on Windows 11 with project paths containing spaces, single quotes,
%chars, and non-ASCII characters.HigeMaguro commentedon Sep 7, 2026
Still reproduces on OpenCode Desktop 1.18.29 / Windows 11 (PowerShell 5.1)
Environment:
Same
Error invoking remote method 'open-path'dialog when choosing "Open in → PowerShell" from the top-right dropdown. The invoked command matches the reported root cause — the project path is passed as a positional argument:Additional observation: on a Japanese-locale Windows, the error message inside the dialog is garbled (mojibake) — the localized
CommandNotFoundExceptiontext is rendered with wrong encoding, which may be worth handling in the fix for readability.Hope the PR #46712 lands soon. Happy to test a nightly build if needed.
HigeMaguro commentedon Sep 22, 2026
Still reproducible on a fresh install. Same root cause confirmed.
Environment
Reproduced behavior
open-pathruns:and fails with
CommandNotFoundException(CategoryInfo: ObjectNotFound), because the working directory is passed as a positional argument and PowerShell executes it as a command.Confirmed at the code level - in the packaged
resources\app.asar/out\main\index.js(v1.18.32):The renderer's Windows menu entry is
openWith: "powershell", so this resolves toexecFile("C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe", [path]).I verified the exact failure by running the same command directly:
This is broken on Windows by design of the
open-pathhandler, independent of shell version (affects both Windows PowerShell 5.1 and pwsh 7).Note: A fix PR is already open and awaiting review/merge: #46712 (
cmd /d /c start+-EncodedCommand/Set-Location -LiteralPath). Happy to retest once it lands.thdxr commentedon Oct 11, 2026
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (
opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊