Failed to apply patch

Resolved 💬 2 comments Opened Aug 14, 2025 by slimndap Closed Oct 17, 2025
💡 Likely answer: A maintainer (dylan-hurd-oai, contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

0.21.0

Which model were you using?

o4-mini

What platform is your computer?

Darwin 21.6.0 x86_64 i386

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?

All changes applied and saved to my files.

What do you see instead?

✘ 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:

Additional information

This 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.

This a follow-up to #1829 which was closed for some reason.

View original on GitHub ↗

2 Comments

dylan-hurd-oai contributor · 1 year ago

I think this might be a bug in the configuration, where codex -a never also implicitly resolves to -s read-only. If you run with the following command do you still see this issue?

codex -a never -s workspace-write
tibo-openai collaborator · 10 months ago

We've revamped the apply_patch implementation, please re-open an issue if this still occurs.