Repository navigation
Description
Description
Description
After updating OpenCode from 2.2.7 to 2.3.0 on Windows, shell tool calls using Microsoft Store PowerShell 7 fail before executing even a one-line command:
failed to spawn C:\Program Files\WindowsApps\Microsoft.PowerShell_7.7.0.0_x64__8wekyb3d8bbwe\pwsh.EXE:
OS Error -1073283067 (FormatMessageW() returned error 317) (os error -1073283067)
-1073283067 is 0xC0070005. Expected: the command executes and returns its output. Actual: process creation fails, in both a project directory and a separate temporary directory.
Isolated Win32 reproduction
A standalone C# P/Invoke probe, independent of OpenCode/plugins, called CreateProcessW for the same packaged executable with -NoLogo -NoProfile -NonInteractive -Command "exit 0" and CREATE_NO_WINDOW. Changing only the job attachment strategy produced:
| Creation strategy | Store PowerShell 7.7 | Windows PowerShell 5.1 |
|---|---|---|
| No explicit job attribute | Success, exit 0 | Success, exit 0 |
STARTUPINFOEXW + EXTENDED_STARTUPINFO_PRESENT + PROC_THREAD_ATTRIBUTE_JOB_LIST containing one newly created unnamed job |
Fails: 0xC0070005 |
Success, exit 0 |
Normal creation, then AssignProcessToJobObject |
Success, assignment succeeds, exit 0 | Success, exit 0 |
Three additional consecutive rounds reproduced the same Store executable results. Normal ProcessStartInfo creation also succeeds for both the real packaged EXE and its app-execution aliases. Get-AppxPackage Microsoft.PowerShell reports Status=Ok and IsPartiallyStaged=False.
At the failing timestamps, Microsoft-Windows-AppModel-Runtime/Admin records:
- Event 212,
0x80070005: cannot add the process to the package's Desktop AppX container. - Event 208,
0x80070005: cannot create the package process while configuring its runtime,[FinishPackageActivation].
Relevant implementation
The running shell process is launched through opencode-pty 0.5.2, in pipe mode. The current Windows pipe implementation supplies PROC_THREAD_ATTRIBUTE_JOB_LIST during CreateProcessW.
Its jobless retry only accepts raw ERROR_ACCESS_DENIED (5); the packaged EXE returns 0xC0070005, so that retry is skipped. The standalone probe returns 5 when given the app-execution alias instead of the real packaged path. This error-code distinction appears relevant to the missed fallback.
The 2.2.7 shell service directly spawned commands; 2.3.0 delegates local commands to the process daemon. Related introduction: #63196; follow-up: #63346. The previous 2.2.7 binary was not rerun during this diagnosis, so the version boundary is based on observed upgrade history and source comparison, not a binary bisect.
This differs from closed #62512: that issue returned exit 0 with empty output through the Store alias; this one fails to create the real packaged process.
Workaround verified: explicitly selecting Windows PowerShell 5.1 restores shell execution. MSI/ZIP PowerShell 7 was not installed or tested. No WindowsApps ACL changes or package repairs were made.
Plugins
@tarquinen/opencode-dcp@latest, oh-my-opencode-slim. OpenCode itself was not retested with plugins disabled; the standalone Win32 probe has no plugin dependency.
OpenCode version
opencode v2.3.0, latest/release channel, installed through Scoop; managed serve --service process. Process daemon: opencode-pty 0.5.2.
Steps to reproduce
- On Windows, use Microsoft Store PowerShell 7 (observed package:
Microsoft.PowerShell_7.7.0.0_x64__8wekyb3d8bbwe), with OpenCode 2.3.0 selecting that shell. - Ask the shell tool to run
Write-Output 'probe'. - Observe the spawn failure above, before any command output. Changing the working directory does not help.
- For an API-level comparison, create that same EXE with and without
PROC_THREAD_ATTRIBUTE_JOB_LIST, as described in the table.
Operating System
Windows x64, Windows_NT 10.0.26300 ([Environment]::OSVersion: 10.0.26300.0). Store PowerShell reports 7.7.0. System Windows PowerShell reports 5.1.26100.9818.
Terminal
Exact frontend terminal application unavailable. Shell-tool environment has TERM=xterm-256color (injected by OpenCode); TERM_PROGRAM, COLORTERM, and WT_SESSION are unset. ComSpec=C:\WINDOWS\system32\cmd.exe.
Plugins
No response
OpenCode version
2.3.0
Steps to reproduce
No response
Screenshot
No response
Operating System
No response
Terminal
No response
Activity
opencodejr commentedon Nov 14, 2026
Thanks for the detailed report and the standalone Win32 probe.
I couldn't reproduce this here. It needs Windows with PowerShell 7 installed from the Microsoft Store, and this sandbox runs Linux, so a maintainer with that setup will need to confirm it.
On the latest
dev(6205e99),spawn()inpackages/process-daemon/src/service/pipe/windows.rsstill retries without the job only when the error is exactlyERROR_ACCESS_DENIED(5). If Windows returns0xC0070005for the packagedpwsh.EXE, as your probe shows, that retry is skipped, which matches the failure you describe. I haven't been able to observe that Windows behaviour myself.Until then, the workaround you found (selecting Windows PowerShell 5.1) should keep the shell tool working.
devicbest commentedon Nov 15, 2026
Confirming from a working setup, to narrow this down:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exeSo the failure looks tied to the Microsoft Store pwsh 7 binary path (
C:\Program Files\WindowsApps\...), not to 2.3.0 or Windows itself: same OS and same OpenCode version, only the shell executable differs.mvanhorn commentedon Nov 15, 2026
Implemented in #64137.