codex - 💡(How to fix) Fix `file_change` fails under `workspace-write` when `sandbox_workspace_write.network_access = true`

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

On Codex CLI v0.121.0, file edits via the file_change / patch tool fail in a trusted local project when workspace-write is combined with:

[sandbox_workspace_write]
network_access = true

This does not affect ordinary shell commands in the same session: touch, printf > file, git status, and sandboxed Python commands still work. The failure appears specific to the patch/file-change path.

Disabling network_access = true makes the problem go away immediately.

Error Message

The file_change step fails, even though normal shell writes work.

Root Cause

On Codex CLI v0.121.0, file edits via the file_change / patch tool fail in a trusted local project when workspace-write is combined with:

[sandbox_workspace_write]
network_access = true

This does not affect ordinary shell commands in the same session: touch, printf > file, git status, and sandboxed Python commands still work. The failure appears specific to the patch/file-change path.

Disabling network_access = true makes the problem go away immediately.

Fix Action

Workaround

Comment out:

[sandbox_workspace_write]
network_access = true

Then rerun:

codex exec --json --full-auto "create a file foo.txt containing hello"

This succeeds, and the file_change step completes normally.

Code Example

[sandbox_workspace_write]
network_access = true

---

model = "gpt-5.4"
model_reasoning_effort = "xhigh"
personality = "pragmatic"
web_search = "live"
sandbox_mode = "workspace-write"

[sandbox_workspace_write]                                                     
network_access = true 

[projects."/home/jvdh/Documents/jobwatch"]
trust_level = "trusted"

[tui]
status_line = ["model-with-reasoning", "current-dir", "context-used", "weekly-limit", "total-input-tokens", "total-output-tokens"]

[features]
multi_agent = true
prevent_idle_sleep = true

---

[shell_environment_policy]
inherit = "all"
set = { PATH = "/home/jvdh/Documents/jobwatch/.venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" }

[sandbox_workspace_write]
network_access = true

---

codex exec --json --full-auto "create a file foo.txt containing hello"

---

{"type":"item.started","item":{"id":"item_4","type":"file_change","changes":[{"path":"/home/jvdh/Documents/jobwatch/foo.txt","kind":"add"}],"status":"in_progress"}}
{"type":"item.completed","item":{"id":"item_4","type":"file_change","changes":[{"path":"/home/jvdh/Documents/jobwatch/foo.txt","kind":"add"}],"status":"failed"}}

---

Failed to read file to update /home/jvdh/Documents/jobwatch/foo.txt: fs sandbox helper failed with status exit status: 101: thread 'main' (...) panicked at linux-sandbox/src/linux_run_main.rs:130:27:
legacy sandbox policy must match split sandbox policies:
provided=WorkspaceWrite { writable_roots: [AbsolutePathBuf("/home/jvdh/.codex/memories")], read_only_access: FullAccess, network_access: true, exclude_tmpdir_env_var: false, exclude_slash_tmp: false },
derived=WorkspaceWrite { writable_roots: [AbsolutePathBuf("/home/jvdh/.codex/memories")], read_only_access: FullAccess, network_access: false, exclude_tmpdir_env_var: false, exclude_slash_tmp: false }

---

[sandbox_workspace_write]
network_access = true

---

codex exec --json --full-auto "create a file foo.txt containing hello"

---

sandbox_mode = "workspace-write"
[sandbox_workspace_write]                                                     
network_access = true

---

codex exec --json --full-auto "create a file foo.txt containing hello"
RAW_BUFFERClick to expand / collapse

What version of Codex CLI is running?

v0.121.0

What subscription do you have?

Plus

Which model were you using?

gpt-5.4

What platform is your computer?

Linux 6.8.0-110-generic x86_64 x86_64

What terminal emulator and version are you using (if applicable)?

Terminal

What issue are you seeing?

Summary

On Codex CLI v0.121.0, file edits via the file_change / patch tool fail in a trusted local project when workspace-write is combined with:

[sandbox_workspace_write]
network_access = true

This does not affect ordinary shell commands in the same session: touch, printf > file, git status, and sandboxed Python commands still work. The failure appears specific to the patch/file-change path.

Disabling network_access = true makes the problem go away immediately.

Environment

  • Codex CLI: v0.121.0
  • OS: Ubuntu Linux
  • Project: trusted local repo
  • Working directory: repo root

My config:

model = "gpt-5.4"
model_reasoning_effort = "xhigh"
personality = "pragmatic"
web_search = "live"
sandbox_mode = "workspace-write"

[sandbox_workspace_write]                                                     
network_access = true 

[projects."/home/jvdh/Documents/jobwatch"]
trust_level = "trusted"

[tui]
status_line = ["model-with-reasoning", "current-dir", "context-used", "weekly-limit", "total-input-tokens", "total-output-tokens"]

[features]
multi_agent = true
prevent_idle_sleep = true

Project-scoped config used for repro:

[shell_environment_policy]
inherit = "all"
set = { PATH = "/home/jvdh/Documents/jobwatch/.venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" }

[sandbox_workspace_write]
network_access = true

Reproduction

Run:

codex exec --json --full-auto "create a file foo.txt containing hello"

Observed behavior

The file_change step fails, even though normal shell writes work.

Relevant sanitized log excerpt:

{"type":"item.started","item":{"id":"item_4","type":"file_change","changes":[{"path":"/home/jvdh/Documents/jobwatch/foo.txt","kind":"add"}],"status":"in_progress"}}
{"type":"item.completed","item":{"id":"item_4","type":"file_change","changes":[{"path":"/home/jvdh/Documents/jobwatch/foo.txt","kind":"add"}],"status":"failed"}}

When retrying after creating the file through the shell, the update path fails with:

Failed to read file to update /home/jvdh/Documents/jobwatch/foo.txt: fs sandbox helper failed with status exit status: 101: thread 'main' (...) panicked at linux-sandbox/src/linux_run_main.rs:130:27:
legacy sandbox policy must match split sandbox policies:
provided=WorkspaceWrite { writable_roots: [AbsolutePathBuf("/home/jvdh/.codex/memories")], read_only_access: FullAccess, network_access: true, exclude_tmpdir_env_var: false, exclude_slash_tmp: false },
derived=WorkspaceWrite { writable_roots: [AbsolutePathBuf("/home/jvdh/.codex/memories")], read_only_access: FullAccess, network_access: false, exclude_tmpdir_env_var: false, exclude_slash_tmp: false }

Expected behavior

With workspace-write and [sandbox_workspace_write].network_access = true, the patch/file-change tool should be able to create and edit files inside the workspace, just like shell commands can.

Workaround

Comment out:

[sandbox_workspace_write]
network_access = true

Then rerun:

codex exec --json --full-auto "create a file foo.txt containing hello"

This succeeds, and the file_change step completes normally.

Notes

This does not look like a general sandbox write failure:

  • bwrap is present
  • target file is inside the workspace
  • shell writes succeed
  • sandboxed Python succeeds
  • only the patch/file-change path fails

This looks like an internal sandbox policy mismatch in the file-change helper when network_access = true is enabled for workspace-write.

What steps can reproduce the bug?

set

sandbox_mode = "workspace-write"
[sandbox_workspace_write]                                                     
network_access = true

Run:

codex exec --json --full-auto "create a file foo.txt containing hello"

What is the expected behavior?

With workspace-write and [sandbox_workspace_write].network_access = true, the patch/file-change tool should be able to create and edit files inside the workspace, just like shell commands can.

Additional information

No response

extent analysis

TL;DR

The issue can be fixed by disabling network_access = true in the [sandbox_workspace_write] configuration.

Guidance

  • The problem seems to be caused by an internal sandbox policy mismatch when network_access = true is enabled for workspace-write.
  • To verify, try commenting out the network_access = true line in the [sandbox_workspace_write] section of the configuration file and then rerun the codex exec command.
  • If the issue persists, check the sandbox policy configuration to ensure it matches the expected settings.
  • To mitigate the issue, disable network_access = true until a permanent fix is available.

Example

No code snippet is provided as the issue is related to configuration settings.

Notes

The provided workaround suggests that disabling network_access = true resolves the issue, but this may not be a permanent solution. Further investigation into the sandbox policy configuration may be necessary to determine the root cause.

Recommendation

Apply the workaround by commenting out network_access = true in the [sandbox_workspace_write] section, as this has been shown to resolve the issue in the short term.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

With workspace-write and [sandbox_workspace_write].network_access = true, the patch/file-change tool should be able to create and edit files inside the workspace, just like shell commands can.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix `file_change` fails under `workspace-write` when `sandbox_workspace_write.network_access = true`