Codex cli 0.9Config

Codex: sandbox permission error running shell command

Error: command blocked by sandbox policy (write outside workspace)
Affected versions
cli 0.9
Fixed in
Last verified
Codex CLI 0.9

Root cause

Codex runs commands in a restricted sandbox; a command tried to write outside the approved workspace or needed network the policy denies.

How to reproduce

Ask Codex to run a script that writes to a system path or fetches the network under default sandbox.

Solutions (2)

Ordered by community votes. Always check the verified version before applying.

28
#1Applies to cli 0.9

Set the approval/sandbox mode appropriately (e.g. workspace-write) or grant the specific command approval when prompted, instead of disabling the sandbox wholesale.

Last verified: Codex CLI 0.9 · community

12
#2Applies to cli 0.9

Keep writes inside the project directory; redirect output to a workspace path rather than a system or home path.

Last verified: Codex CLI 0.9 · community

Related errors