Skip to content

shell: Store PowerShell fails with 0xC0070005 in Windows pipe mode #63892

Open

Description

@Simon7612

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

  1. 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.
  2. Ask the shell tool to run Write-Output 'probe'.
  3. Observe the spawn failure above, before any command output. Changing the working directory does not help.
  4. 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

  1. opencodejr commented on Nov 14, 2026

    @opencodejr
    Contributor

    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() in packages/process-daemon/src/service/pipe/windows.rs still retries without the job only when the error is exactly ERROR_ACCESS_DENIED (5). If Windows returns 0xC0070005 for the packaged pwsh.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.

  2. devicbest commented on Nov 15, 2026

    @devicbest

    Confirming from a working setup, to narrow this down:

    • Windows 11 x64, OpenCode Desktop 2.3.0 (opencode-cli 2.3.0-x64)
    • Shell in use: Windows PowerShell 5.1 at C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
    • Shell tool calls work normally (no 0xC0070005)

    So 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.

  3. mvanhorn commented on Nov 15, 2026

    @mvanhorn

    Implemented in #64137.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions