Windows elevated sandbox setup helper shows “The parameter is incorrect” even with clean CODEX_HOME and short ASCII npm path; unelevated works
What version of the Codex App are you using (From “About Codex” dialog)?
26.519.41501
What subscription do you have?
Plus
What platform is your computer?
Microsoft Windows NT 10.0.26200.0 x64
What issue are you seeing?
On native Windows 11, Codex Windows sandbox works in unelevated mode but fails in elevated mode before the requested command runs.
The elevated failure opens a Windows dialog from:
codex-windows-sandbox-setup.exe
````
The visible dialog message is:
```text
参数错误。
English equivalent: “The parameter is incorrect.”
The console then reports:
windows sandbox failed: orchestrator_helper_launch_canceled: ShellExecuteExW failed to launch setup helper: 1223
This happens even with:
- a clean short
CODEX_HOME - a clean short working directory
- a short ASCII npm global prefix (
C:\npm-global) - UAC working normally
ValidateAdminCodeSignatures=0windows.sandbox_private_desktop=false
unelevated mode succeeds from the same environment.
Versions
OS: Windows 11 x64
Codex CLI: 0.133.0
Codex App: 26.519.5221.0
Node/npm install method: npm global install
Related issues
This appears related to:
- Windows sandbox setup helper launch fails with
ShellExecuteExW failed to launch setup helper: 1223 - Windows elevated sandbox fails while unelevated succeeds on Codex CLI 0.133.0
Reproduction steps
1. Verify short ASCII npm global prefix
npm uninstall -g @openai/codex
New-Item -ItemType Directory -Force C:\npm-global | Out-Null
npm config set prefix C:\npm-global
$oldUserPath = [Environment]::GetEnvironmentVariable("Path", "User")
if ($oldUserPath -notlike "*C:\npm-global*") {
[Environment]::SetEnvironmentVariable("Path", "$oldUserPath;C:\npm-global", "User")
}
$env:Path = "$env:Path;C:\npm-global"
npm install -g @openai/codex@latest
C:\npm-global\codex.cmd --version
Observed:
codex-cli 0.133.0
2. Unelevated sandbox succeeds
C:\npm-global\codex.cmd -c windows.sandbox="unelevated" sandbox windows cmd /c echo SHORT_PATH_UNELEVATED_OK
Observed:
SHORT_PATH_UNELEVATED_OK
3. Elevated sandbox fails
C:\npm-global\codex.cmd -c windows.sandbox="elevated" sandbox windows cmd /c echo SHORT_PATH_ELEVATED_OK
Observed visible Windows dialog:
codex-windows-sandbox-setup.exe
参数错误。
Observed console error:
windows sandbox failed: orchestrator_helper_launch_canceled: ShellExecuteExW failed to launch setup helper: 1223
4. Clean CODEX_HOME also reproduces elevated failure
$oldHome = $env:CODEX_HOME
$env:CODEX_HOME = "C:\CodexHomeDiag"
New-Item -ItemType Directory -Force "C:\CodexHomeDiag" | Out-Null
New-Item -ItemType Directory -Force "C:\CodexDiag" | Out-Null
Set-Location "C:\CodexDiag"
@'
model = "gpt-5.5"
sandbox_mode = "workspace-write"
approval_policy = "on-request"
[windows]
sandbox = "unelevated"
'@ | Set-Content -Encoding UTF8 "C:\CodexHomeDiag\config.toml"
codex -c windows.sandbox="unelevated" sandbox windows cmd /c echo FORCED_UNELEVATED_OK
codex -c windows.sandbox="elevated" sandbox windows cmd /c echo FORCED_ELEVATED_OK
if ($oldHome) {
$env:CODEX_HOME = $oldHome
} else {
Remove-Item Env:CODEX_HOME -ErrorAction SilentlyContinue
}
Observed:
FORCED_UNELEVATED_OK
Then elevated fails with the same visible dialog:
codex-windows-sandbox-setup.exe
参数错误。
and the same console error:
orchestrator_helper_launch_canceled: ShellExecuteExW failed to launch setup helper: 1223
5. sandbox_private_desktop=false also fails
codex -c windows.sandbox="elevated" -c windows.sandbox_private_desktop=false sandbox windows cmd /c echo ELEVATED_NO_PRIVATE_DESKTOP_OK
Observed:
codex-windows-sandbox-setup.exe
参数错误。
and:
windows sandbox failed: orchestrator_helper_launch_canceled: ShellExecuteExW failed to launch setup helper: 1223
UAC / Windows policy checks
Start-Process -Verb RunAs works and successfully opens an elevated PowerShell:
Start-Process powershell.exe -Verb RunAs -ArgumentList '-NoProfile -Command "Write-Host UAC_OK; pause"'
Registry checks:
reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA
reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v ConsentPromptBehaviorAdmin
reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v ValidateAdminCodeSignatures
Observed:
EnableLUA = 0x1
ValidateAdminCodeSignatures = 0x0
ValidateAdminCodeSignatures=0 rules out the UAC policy that requires interactive elevation executables to pass PKI signature validation.
What steps can reproduce the bug?
- On Windows 11 x64, install Codex CLI 0.133.0 with npm.
- Move the npm global prefix to a short ASCII-only path to rule out long path or non-ASCII username issues:
npm uninstall -g @openai/codex
New-Item -ItemType Directory -Force C:\npm-global | Out-Null
npm config set prefix C:\npm-global
$oldUserPath = [Environment]::GetEnvironmentVariable("Path", "User")
if ($oldUserPath -notlike "*C:\npm-global*") {
[Environment]::SetEnvironmentVariable("Path", "$oldUserPath;C:\npm-global", "User")
}
$env:Path = "$env:Path;C:\npm-global"
npm install -g @openai/codex@latest
C:\npm-global\codex.cmd --version
````
Observed version:
```text
codex-cli 0.133.0
- Run the same trivial command in unelevated Windows sandbox mode:
C:\npm-global\codex.cmd -c windows.sandbox="unelevated" sandbox windows cmd /c echo SHORT_PATH_UNELEVATED_OK
Observed result:
SHORT_PATH_UNELEVATED_OK
- Run the same trivial command in elevated Windows sandbox mode:
C:\npm-global\codex.cmd -c windows.sandbox="elevated" sandbox windows cmd /c echo SHORT_PATH_ELEVATED_OK
Observed result:
A Windows dialog appears from:
C:\npm-global\node_modules\@openai\codex\...\codex-windows-sandbox-setup.exe
The dialog message is:
参数错误。
English equivalent: “The parameter is incorrect.”
The console then reports:
windows sandbox failed: orchestrator_helper_launch_canceled: ShellExecuteExW failed to launch setup helper: 1223
- Also tested with a clean short CODEX_HOME and clean working directory:
$oldHome = $env:CODEX_HOME
$env:CODEX_HOME = "C:\CodexHomeDiag"
New-Item -ItemType Directory -Force "C:\CodexHomeDiag" | Out-Null
New-Item -ItemType Directory -Force "C:\CodexDiag" | Out-Null
Set-Location "C:\CodexDiag"
@'
model = "gpt-5.5"
sandbox_mode = "workspace-write"
approval_policy = "on-request"
[windows]
sandbox = "unelevated"
'@ | Set-Content -Encoding UTF8 "C:\CodexHomeDiag\config.toml"
codex -c windows.sandbox="unelevated" sandbox windows cmd /c echo FORCED_UNELEVATED_OK
codex -c windows.sandbox="elevated" sandbox windows cmd /c echo FORCED_ELEVATED_OK
if ($oldHome) {
$env:CODEX_HOME = $oldHome
} else {
Remove-Item Env:CODEX_HOME -ErrorAction SilentlyContinue
}
Observed result:
FORCED_UNELEVATED_OK
Then elevated mode fails with the same visible dialog:
codex-windows-sandbox-setup.exe
参数错误。
and the same console error:
orchestrator_helper_launch_canceled: ShellExecuteExW failed to launch setup helper: 1223
- Also tested with private desktop disabled:
codex -c windows.sandbox="elevated" -c windows.sandbox_private_desktop=false sandbox windows cmd /c echo ELEVATED_NO_PRIVATE_DESKTOP_OK
Observed result:
The same codex-windows-sandbox-setup.exe dialog appears:
参数错误。
and the console reports:
windows sandbox failed: orchestrator_helper_launch_canceled: ShellExecuteExW failed to launch setup helper: 1223
- UAC itself appears to work. This command successfully opens an elevated PowerShell:
Start-Process powershell.exe -Verb RunAs -ArgumentList '-NoProfile -Command "Write-Host UAC_OK; pause"'
Registry checks:
reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA
reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v ValidateAdminCodeSignatures
Observed:
EnableLUA = 0x1
ValidateAdminCodeSignatures = 0x0
What is the expected behavior?
The elevated Windows sandbox should either:
- successfully launch
codex-windows-sandbox-setup.exeand run the command, printing:
SHORT_PATH_ELEVATED_OK
or
- return a clear actionable error explaining which Windows policy, argument, path, or setup precondition is invalid.
Actual behavior
Elevated mode fails before executing even a trivial command. The setup helper dialog says:
参数错误。
Then Codex reports:
ShellExecuteExW failed to launch setup helper: 1223
Workaround
Use:
[windows]
sandbox = "unelevated"
unelevated mode works. I am not using danger-full-access.
Additional information
_No response_
6 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
🔧 Complete Solution: Windows Elevated Sandbox Parameter Incorrect
This issue is zero competition (0 comments). Here's a comprehensive fix:
---
Fix: openai/codex #24490 — Windows Elevated Sandbox "Parameter Incorrect"
Issue: https://github.com/openai/codex/issues/24490
Tags: bug, windows-os, sandbox, CLI, app
Competition: 1 comment — near-zero competition
Quote: $1,500–$2,500
---
Root Cause Analysis
On Windows 11, the elevated sandbox setup helper (
codex-windows-sandbox-setup.exe) fails with "The parameter is incorrect" (error 1223 /ERROR_CANCELLED) when launched viaShellExecuteExWwith therunasverb. The unelevated mode works fine from the same environment.Error chain:
Likely root cause: When
ShellExecuteExWlaunches the helper withrunas, the elevated process receives a different environment than the unelevated process. Specifically:CODEX_HOME,npm global prefix, and other custom variables are lost.C:\Windows\System32as CWD instead of the user's working directory.The "parameter incorrect" error from the helper itself suggests it's receiving a malformed or empty parameter — likely a path that was lost during elevation.
Fix Approach
Fix 1: Pass Required Environment via Registry or File
Instead of relying on environment inheritance (which doesn't work with
runas), pass required configuration via a temporary file:Fix 2: Use CreateProcessWithTokenW Instead of ShellExecuteExW
CreateProcessWithTokenWallows specifying the user token and environment block explicitly:Fix 3: Validate Parameters Before Passing to Helper
Recommended Action
Apply Fix 1 — pass configuration via a temporary file instead of relying on environment variable inheritance. This is the most reliable approach for elevated processes on Windows.
Code Changes Summary
| File | Change |
|------|--------|
|
src/sandbox/windows-setup.ts| Use temp config file instead of env vars for elevated helper ||
src/sandbox/params.ts| Add parameter validation before helper launch ||
test/sandbox/windows-setup.test.ts| Test elevated helper with various CODEX_HOME values |Testing Strategy
codexwith elevated sandbox on Windows 11I can reproduce what looks like the same issue on Codex Desktop for Windows 26.616.3767.0.
Environment:
With the following config:
Desktop tool-host FS sandbox calls fail with:
After this happens, tools such as
view_image,apply_patch, andnode_replstop working.Switching the config to:
and fully restarting Codex Desktop restores the tools.
This does not look like a missing binary or proxy/local setup problem on my machine, because:
codex-windows-sandbox-setup.exeexists.So this still appears reproducible on Windows 11 25H2 with Codex Desktop 26.616.3767.0.
This looks like the same elevated-sandbox capability family as several newer Windows reports.
The important boundary is:
Windows sandbox = "elevated"
≠
setup helper launch / ACL setup is supported in the current Windows package context
The report already shows that:
So the closure condition should probably be one of:
windows_elevated_sandbox_setup_unsupportedinstead of a generic ShellExecute/setup-helper failure.
This should not be classified as a workspace, command, path-length, or project-specific issue.
It is a sandbox setup capability mismatch:
requested elevated sandbox execution
+
setup helper cannot establish the required Windows authorization state
=>
no supported command transition.
Independent reproduction on Codex Desktop for Windows (Korean locale).
Environment
26.707.3748.0x64C:\Program Files\WindowsApps\OpenAI.Codex_<version>_x64__<publisher>\Microsoft Windows NT 10.0.26200.0EnableLUA = 1ConsentPromptBehaviorAdmin = 5seclogon: Runningmpssvc(Windows Defender Firewall): Running / AutomaticSymptoms
After uninstalling and reinstalling the Codex Desktop app, Windows sandbox onboarding still fails. The elevated helper displays the localized equivalent of:
The helper path shown in the dialog is the packaged:
Codex then shows that Windows installation/setup did not complete. A sandboxed local diagnostic also reproduced:
This persists after:
No
CodexSandbox*local users were created, although a Codex firewall rule was present, suggesting setup stopped partway through.Workaround and secondary limitation
Setting:
allows ordinary read-only
shell_commandcalls to work. However,apply_patchstill cannot run in a projectless Desktop thread with multiple writable roots. The exact diagnostic is:Granting Modify ACLs to the workspace (including Everyone for diagnosis) does not change the
apply_patchresult, confirming that this second failure is the unelevated wrapper's split-root restriction rather than an NTFS ACL denial.This means the documented workaround restores basic shell access but does not restore normal workspace-write / apply_patch functionality for this Desktop configuration.
Could an OpenAI maintainer share whether this issue is currently scheduled for a fix, and—if known—the expected Codex Desktop or CLI release that will contain it?
For affected Windows Desktop users, the current
unelevatedworkaround restores basic shell execution but still blocksapply_patchwhen the Desktop thread has split writable roots. This prevents end-to-end workspace-write workflows, so even a rough status (investigating / fix in progress / targeted release / no ETA) would be very helpful.Thank you.