Windows sandbox recovery fails: codex-windows-sandbox-setup.exe exits with 0xc0000142 after DPAPI error
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.5k
- PR merge metrics
- PR metrics pending
Description
What version of the Codex App are you using (From “About Codex” dialog)?
Versão atual: 26.813.12317
What subscription do you have?
Plus
What platform is your computer?
Microsoft Windows NT 10.0.26200.0 x64
What issue are you seeing?
The Codex Windows native sandbox can no longer start any local command.
Every command fails before PowerShell or any child process starts:
windows sandbox: CryptUnprotectData failed: 2148073483
The error corresponds to 0x8009000B (NTE_BAD_KEY_STATE).
Current-user DPAPI encryption and decryption work correctly. The failure appears to be specific to the Codex sandbox credentials.
As a recovery test, with Codex completely closed, I renamed:
%USERPROFILE%\.codex\.sandbox-secrets
to .sandbox-secrets-backup.
After reopening Codex, sandbox recreation also failed with:
codex-windows-sandbox-setup.exe - Application Error
The application was unable to start correctly (0xc0000142).
Restoring the original directory returns Codex to the original CryptUnprotectData failure.
Related issue: #35841
What steps can reproduce the bug?
- Open Codex on Windows using the native Windows sandbox.
- Open any local project.
- Ask Codex to run
Get-Location. - Observe
CryptUnprotectData failed: 2148073483. - Close Codex completely.
- Rename
%USERPROFILE%\.codex\.sandbox-secretsto.sandbox-secrets-backup. - Reopen Codex.
- Observe that
codex-windows-sandbox-setup.exefails with0xc0000142.
What is the expected behavior?
If the stored sandbox credentials cannot be decrypted, Codex should safely regenerate its sandbox credentials. The sandbox setup executable should start successfully, and local commands should execute normally.
Additional information
I can reproduce the same CryptUnprotectData failed: 2148073483 error.
I also observed a failure in the recovery path. With Codex completely closed, I temporarily renamed:
%USERPROFILE%\.codex\.sandbox-secrets
After reopening Codex, sandbox recreation failed with:
codex-windows-sandbox-setup.exe - Application Error
The application was unable to start correctly (0xc0000142).
Restoring the original .sandbox-secrets directory returns Codex to the original DPAPI failure.
Troubleshooting performed:
- Restarted Windows
- Reset and reinstalled the app
- Recreated the runtime cache
- Restored an older
config.toml - Confirmed that current-user DPAPI encryption/decryption works
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure using the native Windows sandbox, the CryptUnprotectData error, and the %USERPROFILE%\.codex\.sandbox-secrets recovery path. Start by tracing the entry point for codex-windows-sandbox-setup.exe and its handling of undecryptable credentials. Done means credentials are safely regenerated, the setup executable starts, and local commands run normally.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- operating-systems, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100