Failed to write file - Permission denied (os error 13)

Resolved 💬 4 comments Opened Aug 4, 2025 by kelso Closed Aug 12, 2025

What version of Codex is running?

codex-cli 0.11.0

Which model were you using?

codex-mini-latest

What platform is your computer?

Linux 5.15.167.4-microsoft-standard-WSL2 aarch64 aarch64

What steps can reproduce the bug?

  1. run codex as codex -a never
  2. enter any prompt that will modify project files

What is the expected behavior?

Files are modified/created,

What do you see instead?

applying patch
(...)

event
PatchApplyEnd(PatchApplyEndEvent { call_id: "call_pNSNkpWbKeW6yIryVZNy1aiw", stdout: "", stderr: "Failed to write file app/views/dashboard/media_items/_media_item.html.erb\n\nCaused by:\n    Permission denied (os error 13)\n", success: true })

And btw the result is taking too much time - like minutes for basic question, i.e. "create new file example.txt"

Additional information

_No response_

View original on GitHub ↗

4 Comments

slimndap · 1 year ago

Is this on the radar? I am still seeing this in v0.14.0. It was introduced in v0.11.0. The only way to keep using Codex CLI is by reverting back to 0.10.0.

I am on macOs Monterey 12.7.6.

Output in codex-cli 0.14.0:

✏️ Applying patch to 1 file (+13 -2)
  ⎿ /Users/[...].php (+13 -2)

✘ Failed to apply patch
  ⎿ Failed to write file [...].php
kelso · 1 year ago

Interesting, after updating to the v0.14.0 on my platform (Linux 5.15.167.4-microsoft-standard-WSL2 aarch64 aarch64) it runs fine.

slimndap · 1 year ago

The problem is still present in 0.21.0 - codex-x86_64-apple-darwin:

✘ Failed to apply patch
  ⎿ Failed to write file includes/[...].php

codex
I can’t modify files directly in read-only mode, but here’s the exact patch you 
can apply to `[...].php` to replace the AI call with simple structured‐data handling:

Again, the problem was introduced in v0.11.0 and remained present in all release after that.
If I downgrade to 0.10.0, the problem is gone.

slimndap · 1 year ago

If files a follow-up issue #2295 since this one was closed.