Couldn't set up admin sandbox
Open 💬 24 comments Opened Mar 16, 2026 by KissSheep-yq
💡 Likely answer: A maintainer (github-actions[bot], contributor)
responded on this thread — see the highlighted reply below.
What version of the IDE extension are you using?
codex 26.311.21342
What subscription do you have?
chatgpt business
Which IDE are you using?
vscode
What platform is your computer?
Windows
What issue are you seeing?
config.toml
model_provider = "openai-official"
model = "GPT-5.3-Codex"
[model_providers.openai-official]
name = "OpenAI Official API"
base_url = "https://api.openai.com/v1"
wire_api = "chat"
requires_openai_auth = true
[windows]
sandbox = "elevated"
auth.json
{
"auth_mode": "apikey",
"OPENAI_API_KEY": "sk-proj-y6Ii_-BRdLsssssssssp2CaLyHtfBLKcKfHMzRLa2jIHGoxxxxxxxKihcS4tX5f3PVST3BxxxxxxxxxZ6y8217gOjKWxxxxxxxx8U_xb8jxxxxxxx8Mmzj5j0A"
}
What steps can reproduce the bug?
Couldn't set up admin sandbox
Use backup sandbox
Why did this situation occur and how should it be resolved subsequently?
What is the expected behavior?
_No response_
Additional information
_No response_
24 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
@KissSheep-yq You published your
OPENAI_API_KEYin a public repository. If this wasn't intentional, please reject this key and generate a new one.Can confirm, it's 100% bricked in all environments. VSCode, and standalone app. It seems Codex was the only dev at openAI, now that it broke itself, it seems it's turned off permanently. I guess AI was fun while it lasted.
https://github.com/openai/codex/issues/14729#issuecomment-4108219251
私の環境では、StandAloneAppは未インストールでした。
この状態でインストールしてSandbox環境がReadOnlyになっていたのをWrite権限に切り替えることが出来、VSCodeでも動くようになりました。
Possible cause:
When Codex updates between versions (in my case v0.113.0 → v0.116.0), on next launch the new binary validates the existing
sandbox_users.jsonandsetup_marker.json. If the stored state is considered incompatible, it triggers a full re-setup with elevation via ShellExecuteExW with runas. The elevation failed silently instead of prompting the user to re-run setup manually with admin rights, falling back to the non-admin sandbox with the "Couldn't set up admin sandbox" message.Workaround:
Rename/delete
~/.codexand re-login in the extension. This forces a clean first-time setup, which goes through elevation correctly.there is not a button to reinstall the sandbox without reloggin in?
This fixed it for me:
Open
C:\Users\UserName\.codex\config.tomlReplace:
with:
Essentially replace "elevated" with "unelevated"
Reload vscode.
keep vibing
Rename C:\Users\UserName\.codex\config.toml to C:\Users\UserName\.codex\config-backup.toml, then restart Codex to let it regenerate C:\Users\UserName\.codex\config.tomlMy approach is to open the .codex folder, and if I find there is no config.toml file, I create one myself and then restart Cursor. That should work.
[6th April 2026] This worked for me and it was perfect. Thank you:)
Very OK!!!!!
I have the same question and delete '.codex' dir seems like not resolve this problem.
https://docs.onlinetool.cc/codex/docs-zh/sandbox.html
See this to modtfy your config.toml
[sandbox_workspace_write]
!
One possible way to solve it?
这个方法在4.9日同样对我有用,感谢
This did not work for me, who else got another way?
I had this issue. I had to allow network access so that the administrator sandbox could actually be set up properly. Without this line added to the configuration, I could only use the fallback sandbox, and was heavily limited.
model = "gpt-5.3-codex"
model_reasoning_effort = "low"
personality = "pragmatic"
approval_policy = "on-request"
sandbox_mode = "workspace-write"
[profiles.full_auto]
approval_policy = "on-request"
sandbox_mode = "workspace-write"
[profiles.readonly_quiet]
approval_policy = "never"
sandbox_mode = "read-only"
[windows]
sandbox = "elevated"
I just enabled Full Access and dropped strong warning in AGENTS.md that it should only do file reading, every other action must take my permission. It's been working so far.
Check your config.toml to see if it overrides the default OpenAI provider. If it does, remove it and restart.
Worked for me!
你这个报错的核心原因基本确定了:Windows 本地 Codex Agent 模式需要 WSL,但你这台机器现在没有安装 WSL。我刚查到扩展配置里明确写着:
Agent mode on Windows currently requires WSL
而你本机运行 wsl --status / wsl -l -v 的结果是:提示要执行 wsl.exe --install,说明 WSL 还没装好。所以 VS Code 里的 Codex 想设置 Windows admin sandbox 时失败,就报了 Couldn't set up admin sandbox。
解决办法
以管理员身份打开 PowerShell。
执行:
wsl --install
如果你想指定 Ubuntu,可以执行:
wsl --install -d Ubuntu
安装完成后重启电脑。
打开 VS Code 设置,搜索:
Run Codex In Windows Subsystem For Linux
把这个选项打开。对应 settings.json 是:
"chatgpt.runCodexInWindowsSubsystemForLinux": true
重载 VS Code,或者完全退出 VS Code 后重新打开。
你现在的环境里还有一个现象:你的账号属于 Administrators 组,但当前 VS Code 不是管理员提升状态,所以管理员权限处于 deny only。不过更推荐走 WSL 方案,不建议长期用“管理员身份运行 VS Code”来解决 Codex,因为扩展自己也写了 Windows 上 Agent 模式推荐/需要 WSL。
codex可以自己解决
谢谢,问题解决的,thanks
This happens after updates; I just delete the config file (you can find it when you go to settings > configuration.