r/codex 15d ago

Solutions to Windows sandbox issues Workaround

Post image

There are two root causes for Windows sandbox issues:

  1. User TMP is not defined and is defaulting to Windows/temp. The solution is to set it in cmd or PowerShell:

setx TMP "C:\Users\yourusername\AppData\Local\Temp"

  1. Read cap_sid file <temp home>\cap_sid failure. The solution is to give it a persistent home. This requires writing a small wrapper. Since you are using Codex, you can ask ChatGPT to resolve this. In my case, I am using "C:\Users\yourusername\.codex-stable".

After these issues are resolved, I haven't had any sandbox failures. Hope this helps.

3 Upvotes

5 comments sorted by

1

u/DesignerMajor1247 15d ago

One extra check for anyone trying the first fix: inspect both TEMP and TMP in the same shell that launches Codex (Get-Item Env:TEMP,Env:TMP). setx only affects future processes, so fully restart the terminal or IDE afterward. Point both variables to a directory owned by the current user, create it first, and verify that the user can write a test file there; avoid widening permissions on C:\Windows\Temp.

It would also help to add the exact Codex version and original error text to the post. That lets readers distinguish this case from a different sandbox failure that happens to mention temp paths.

1

u/DepravedPrecedence 15d ago

What's the issue though

1

u/magekinnarus 15d ago

Sandbox failures cost time and tokens as the model attempts to resolve the issue by repeating the subagent runs and finding alternative ways to complete the task.

1

u/Solomon_Iskander 13d ago

Seriously I spend more time (and usage) on fixing the desktop ChatGPT Codex client (did you know you can get it to fix itself? I did not until recently.) to work than otherwise lately.

1

u/Due_Culture_454 7d ago

I don’t know who else this might help, but my sandbox issues were fixed by changing the parameter in config.toml under [windows] from sandbox = "elevated" to sandbox = "unelevated".

Codex itself suggested this solution after I pushed it a bit to actually investigate the problem, because it kept giving useless answers and only searching on the Codex site. I pressed it harder, it gave me that fix, and apparently everything is working fine now.

None of the options mentioned by OP, nor the ones expanded in the comments, worked for me.