windows: All shell commands crash with "Could not load netstandard 2.0.0.0" at PowerShell startup stage
Title
Windows: All shell commands crash with "Could not load netstandard 2.0.0.0" at PowerShell startup stage
Environment
- codex-cli version: 0.107.0
- OS: Microsoft Windows 10.0.26100
- PowerShell versions: pwsh 7.5.4 (Microsoft Store) + Windows PowerShell 5.1
- Node.js: v24.11.1
Bug Description
Every shell command executed inside Codex CLI fails immediately with a .NET assembly loading error, before the command itself runs. This happens regardless of sandbox mode or command content.
The crash occurs at PowerShell's own startup stage (ConsoleHost.Start / UnmanagedPSEntry.Start), not during command execution.
Steps to Reproduce
- Open PowerShell (pwsh 7.5.4), start Codex CLI with
codex - Enter any prompt that triggers a shell command, e.g.
run: cmd /c echo hello - Observe crash
Error Output
Process terminated. Could not load file or assembly 'netstandard, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. 系统找不到指定的文件。
at Microsoft.PowerShell.ConsoleHost.Start(String bannerText, String helpText, Boolean issProvidedExternally)
at Microsoft.PowerShell.UnmanagedPSEntry.Start(String[] args, Int32 argc)
What I've Tried
| Test | Result |
|------|--------|
| powershell.exe -NoProfile -Command "echo hello" (manual) | ✅ Works |
| pwsh.exe -NoProfile -Command "echo hello" (manual) | ✅ Works |
| Any command inside Codex (e.g. cmd /c echo hello) | ❌ Crashes |
| --dangerously-bypass-approvals-and-sandbox (--yolo) | ❌ Still crashes |
| sandbox_mode = "danger-full-access" in config.toml | ❌ Still crashes |
| cmd /c set > env.txt inside Codex (to dump env) | ❌ Crashes, file not created |
Analysis
- Both PowerShell 5.1 and pwsh 7.5.4 work perfectly when launched manually from the same terminal session.
- The crash happens at
UnmanagedPSEntry.Start, which is before any user command is evaluated. - Disabling the sandbox has no effect.
$env:DOTNET_ROOTis not set in the normal environment.$env:PATHcontainsC:\Program Files\dotnet\and standard system paths.
This strongly suggests that Codex's Rust process modifies the child process environment (e.g. PATH, DOTNET_ROOT, DOTNET_MULTILEVEL_LOOKUP, or COMPlus_* variables) in a way that breaks .NET's assembly resolution when spawning PowerShell.
Since all commands fail (including cmd /c), it appears Codex routes everything through a PowerShell host internally, making the CLI completely unusable on this machine.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗