Codex desktop on Windows cannot start PowerShell host in session (8009001d)
What version of the Codex App are you using (From “About Codex” dialog)?
26.305.950.0
What subscription do you have?
Go, Planning to go Pro if I can get it to work
What platform is your computer?
Microsoft Windows NT 10.0.26200.0 x64
What issue are you seeing?
Summary
Codex desktop is unable to run any shell command on Windows because its managed PowerShell host fails during initialization.
This blocks all repo access and file operations from the assistant, even for trivial commands like Get-Location.
Environment
- OS: Windows
- App: Codex desktop
- Shell configured in session: PowerShell
- Workspace: local repo on Windows filesystem
What I Expected
Codex should be able to start the shell host and run normal commands in the workspace, for example:
Get-Location
Get-ChildItem -Force
git status --short
What Actually Happened
`Every command fails before execution with the same PowerShell host startup error.
Observed errors:
``` text
Internal Windows PowerShell error. Loading managed Windows PowerShell failed with error 8009001d.
Also saw once during earlier attempts:
``` text
CreateProcessWithLogonW failed: 1056
Impact
This makes the coding agent unusable for local development tasks because it cannot:
- inspect files
- search the repo
- edit code
- run tests
- run git commands
Result
The command does not run. The shell host fails immediately with:
Internal Windows PowerShell error. Loading managed Windows PowerShell failed with error 8009001d.
Troubleshooting Already Tried
- Restarted Codex
- Restarted the session/thread
- Granted full access
- Rebooted Windows
- Installed Windows updates
- Ran sfc /scannow with no issues found
- Reinstalled the Codex desktop app
Additional Notes
PowerShell itself appears to work normally outside Codex. Running this manually succeeds:
powershell -NoProfile -Command "Write-Output ok"
That suggests the problem is specific to the Codex desktop shell host / PowerShell integration rather than Windows PowerShell itself.
Request
Please investigate the Windows PowerShell host initialization path in Codex desktop, specifically around the managed host startup and any crypto/profile-related dependency that could trigger error 8009001d.
What steps can reproduce the bug?
Steps To Reproduce
- Open Codex desktop on Windows.
- Open any local workspace.
- Start a new chat/session.
- Ask the agent to run any simple shell command in the workspace, examples:
Get-Location
Get-ChildItem -Force
git status --short
What is the expected behavior?
What I Expected
Codex should be able to start the shell host and run normal commands in the workspace, for example:
Get-Location
Get-ChildItem -Force
git status --short
Additional information
_No response_
38 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Not a duplicate no
I can reproduce the same issue on Windows.
What I verified:
powershell.exe -NoLogo -NoProfilestarts normally outside Codex Desktop.pwsh) also installs and starts normally.codex.exe --helpworks.8009001dPowerShell host error.Integrated terminal shellfromPowerShelltoCommand Promptin Codex Desktop does not fix the issue.Additional details:
powershell.exeworks.codex.exe --helpworks.PowerShell checks:
powershell.exe -NoLogo -NoProfile-> workspwsh -NoLogo -NoProfile-> worksCodex backend check:
...\\vendor\\x86_64-pc-windows-msvc\\codex\\codex.exe --help-> worksMy current conclusion:
If useful, I can also provide the exact Codex Desktop version from “About Codex”.
same problem
I found a solution that worked for me:
C:\Users\<your_pc_username>\AppData\Local\CodexC:\Users\<your_pc_username>\AppData\Roaming\CodexC:\Users\<your_pc_username>\.codexAfter doing this, the issue was resolved for me. Hope it helps!
I also found a solution (using codex):
The fix was to tell Codex to inject two missing Windows environment variables into every shell it starts.
Why this matters:
In your broken Codex shell environment:
That made normal commands like rg, git, python, and cmd fail even though they were installed.
I fixed it by adding these lines to Codex’s config:
That is your per-user Codex config directory:
Not sure if this is a good permanent solution but it's working for me for the time being.
I found this work,I deleted codex in windsurf ,and the windsurf ,and the codex app got worked.
I hit the same desktop-session failure on Windows Codex app
26.306.996.0while working inside the app.What I saw in this session
Internal Windows PowerShell error. Loading managed Windows PowerShell failed with error 8009001d.Get-Location,gh auth status, andGet-ChildItem.Why this may matter
8009001dstartup failure in connection with missingSystemRootwhen PowerShell is launched.If helpful, I can provide the exact failed command list and timestamps from this session.
I found a config-only workaround on Windows Codex Desktop
26.306.996.0that stopped this from reproducing for me.Working config:
Important caveat:
[windows] sandbox = elevated.unelevated, commands inside Codex Desktop started working again.SystemRootandwindir, so I cannot cleanly isolate whether the decisive factor is:unelevatedaloneWhat this does seem to narrow down:
Current result with the working config:
Get-Locationworksgh auth statusworksGet-ChildItemworksSo at minimum, this seems to be a useful narrowing signal:
elevatedvsunelevatedmatters here, andSystemRoot/windiralso appear relevant.thanks, it works for me
我也遇到了这个问题,试了上面的解决方法也没行,有没有大佬能提供下其他方法
thanks, it works for me.
I edited it the way you said, and now it works. Thanks
This also fixed it for me, except I needed 'C:\\Windows' as a literal string. I did not need to change the sandbox to unelevated, it's still
elevatedin my config.[shell_environment_policy]
inherit = "core"
exclude = ["_TOKEN", "_KEY", "*_SECRET"]
set = { SystemRoot = "C:\\Windows", windir = "C:\\Windows" }
对我来说看起来有效,不过工具提示需要增加引号
Don‘t use sandbox!!!
it is not safe bro
I can confirm this on Windows too.
I tested both:
Same result in both: PowerShell/session host fails before command execution with error 8009001d.
What I verified:
This seems broader than just the desktop app issue and may affect the VS Code integration on Windows as well.
Uninstall the Codex desktop app
Uninstall Codex CLI
Delete the following folders if they exist:
C:\Users\<your_pc_username>\AppData\Local\Codex
C:\Users\<your_pc_username>\AppData\Roaming\Codex
C:\Users\<your_pc_username>\.codex
Reinstall Codex , important! Reinstall Codex for windows app ,not Codex Cli, Now you can use Codex app to read your local doc!!
After doing this, the issue was resolved for me. Hope it helps!
I feel bad I still can't figure it out.
I hit the same 8009001d PowerShell startup failure on Windows.
In my case, PowerShell itself was fine outside Codex, but any shell command inside Codex failed before execution, even simple ones like:
Get-Location
Get-ChildItem -Force
The error was:
Internal Windows PowerShell error.
Loading managed Windows PowerShell failed with error 8009001d.
What fixed it for me was updating:
C:\Users\<YourUser>\.codex\config.toml
and explicitly setting these Windows environment variables:
[env]
COMSPEC = "C:\\Windows\\System32\\cmd.exe"
PATHEXT = ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.PYW"
SystemRoot = "C:\\Windows"
windir = "C:\\Windows"
[shell_environment_policy]
inherit = "core"
[shell_environment_policy.set]
COMSPEC = "C:\\Windows\\System32\\cmd.exe"
PATHEXT = ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.PYW"
SystemRoot = "C:\\Windows"
windir = "C:\\Windows"
[windows]
sandbox = "unelevated"
After that, I fully restarted Codex and PowerShell commands started working again.
I also encountered the same problem (windows11 ARM)
I love you bro.
I hit the same issue on Windows. What fixed it for me was changing my Codex config from:
[shell_environment_policy]
inherit = "core"
to
[shell_environment_policy]
inherit = "all"
only delete
C:\Users\<your_pc_username>\.codex,codex can workI was able to fix this issue on my machine (Windows) after several attempts. Sharing what worked for me:
Problem
Codex desktop could not start PowerShell host:
Solution
C:\Users\<your_username>\.codex
C:\Users\<your_username>\AppData\Local\Codex
C:\Users\<your_username>\AppData\Roaming\Codex
C:\Users\CodexSandboxOffline (if exists)
rd /s /q C:\Users\CodexSandboxOffline
"Couldn't set up admin sandbox"
Click:
➡️ Use backup sandbox
Result
After this:
echo hello)---
Notes
Hope this helps someone 👍
Environment:
This might be related to Windows cryptographic or user profile issues causing PowerShell startup failure.
Check if you have imported the configuration of an external Agent, such as Claude Code? If so, delete your config.toml and reopen codex.
amazing!it work to me!!
I hit what appears to be the same root issue on Windows Codex Desktop, and I was able to narrow it down further.
Environment
[windows] sandbox = "unelevated"shell_commandcalls failed before executing even trivial commands such asGet-LocationObserved failure
Internal Windows PowerShell error. Loading managed Windows PowerShell failed with error 8009001d.Important narrowing signal
Start-Process powershell -NoNewWindow -UseNewEnvironment-UseNewEnvironmentworked.powershell -NoProfile -Command "Write-Output ok"That made this look less like a broken PowerShell install and more like Codex launching PowerShell with an overly reduced environment.
My Codex config before the fix was:
What fixed it for me
inherit = "core"inherit = "all"After that, agent shell commands started working immediately again. I verified both:
powershell -NoProfile -Command ...Get-LocationWhy this may matter
.codex, or injectingSystemRoot/windir/COMSPEC.shell_environment_policy.inherit = "core"on Windows causes a PowerShell startup environment that is too stripped down, and changing it toinherit = "all"avoids the8009001dfailure.This might help narrow the bug to the Windows environment inheritance policy used by the desktop shell bridge.
Useful
I can reproduce this in Codex Desktop on Windows. I tested this again in a fresh Codex Desktop thread. PowerShell works normally outside Codex, and
cmd.exealso works normally outside Codex. Inside Codex, every shell execution fails before the actual command runs.Observed error:
Internal Windows PowerShell error. Loading managed Windows PowerShell failed with error 8009001d.Important detail: this does not appear to be only a PowerShell problem in my local environment. Even when the assistant tries to run
cmd.exe /c echo CMD OK, the execution still fails with the same PowerShell host startup error beforecmd.exeactually runs.What I verified:
cmd.exeworks fine outside Codex DesktopFrom my side this looks like a Codex Desktop Windows shell-host / process-launch bug, not a broken local PowerShell installation.
Environment:
Issue:
error: "windows sandbox: runner error: CreateProcessAsUserW failed: 1920" }Fix:
config.toml:[windows] sandbox = "unelevated"[shell_environment_policy] inherit = "all"Thanks to your comment, I was able to fix it without uninstalling and reinstalling the app. Thank you. The key point in my case was updating the
sandboxandinheritsettings.I encountered a similar problem. The Codex app had an issue running PowerShell and couldn't use any commands.
I suspect this is related to the default installation method for PowerShell 7 via MSIX. When using the default installation method with
winget, it installs via MSIX by default:If installed via the MSI method, the location is
$Env:ProgramFiles\PowerShell\7.If installed via the MSIX method, the location is
$Env:ProgramFiles\WindowsApps.However,
ProgramFiles\WindowsAppsis a highly protected directory.MSIX applications are sandboxed, limiting their access to other parts of the system.
After uninstalling the previously MSIX-installed PowerShell 7 and then reinstalling it via MSI, Codex was able to launch PowerShell 7 normally.
References:
Are you on Windows Home? Since Home doesn't support Sandbox, try switching Codex sandbox to unelevated mode, it should work.
[windows]
sandbox = "unelevated"
Useful!!!
This appears to have worked for me.
https://github.com/openai/codex/pull/20089 should address the problem where
inherit = "core"doesn't work on Windows.