codex --sandbox workspace-write --ask-for-approval never cannot write files
Resolved 💬 2 comments Opened Oct 27, 2025 by phubaba Closed Mar 29, 2026
What version of Codex is running?
v0.50.0
What subscription do you have?
something through a company
Which model were you using?
gpt-5-codex
What platform is your computer?
Linux 4.18.0-372.32.1.el8_6.x86_64 x86_64 x86_64
What issue are you seeing?
codex --sandbox workspace-write --ask-for-approval never
Codex is already up to date (version 0.50.0)
╭──────────────────────────────────────────────────╮
│ >_ OpenAI Codex (v0.50.0) │
│ │
│ model: gpt-5-codex medium /model to change │
│ directory: /local_scratch/sata/rforler/git/eis3 │
╰──────────────────────────────────────────────────╯
To get started, describe a task or try one of these commands:
/init - create an AGENTS.md file with instructions for Codex
/status - show current session configuration
/approvals - choose what Codex can do without approval
/model - choose what model and reasoning effort to use
/review - review any changes and find issues
/status
╭───────────────────────────────────────────────────────────────────────╮
│ >_ OpenAI Codex (v0.50.0) │
│ │
│ Model: gpt-5-codex (reasoning medium, summaries detailed) │
│ Directory: /local_scratch/sata/rforler/git/eis3 │
│ Approval: never │
│ Sandbox: workspace-write │
│ Agents.md: AGENTS.md │
│ Session: 019a26fc-b83f-7ec0-821a-b2e63273b345 │
│ │
│ Token usage: 0 total (0 input + 0 output) │
│ Context window: 100% left (0 used / 272K) │
│ Limits: visit chatgpt.com/codex/settings/usage │
╰───────────────────────────────────────────────────────────────────────╯
› write hello.txt
• I'll follow my instructions and check relevant docs before writing hello.txt. Since there aren't specific guidelines for this file,
it feels like a good call to create it with the simple content "hello". I’ll go ahead and create it in the workspace root, using the
apply_patch method.
• Added hello.txt (+1 -0)
1 +hello
✘ Failed to apply patch
└ failed in sandbox
• It seems like I'm facing an issue with apply_patch—maybe the sandbox restricts its use. While typically I wouldn’t need a working
directory for this command, the error suggests it's not permitted in this environment. A viable alternative might be to create a file
using a shell command instead. I’m thinking of executing something like ["bash","-lc","printf 'hello\n' > hello.txt"] to get around
this!
• Ran printf 'hello
│ ' > hello.txt
└ failed in sandbox
What steps can reproduce the bug?
run
codex --sandbox workspace-write --ask-for-approval never
then ask it to write a file
What is the expected behavior?
it should write the file.
Additional information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗