Failed to apply patch

Open 💬 4 comments Opened Apr 1, 2026 by mgryning
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What version of Codex CLI is running?

codex-cli 0.118.0

What subscription do you have?

Pro

Which model were you using?

Gpt-5.4

What platform is your computer?

Linux 6.6.87.2-microsoft-standard-WSL2 x86_64 x86_64

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

Windows Terminal

What issue are you seeing?

Apply_patch fails ~30% of the times after Codex have been running some time. I get a nice purple X failed to apply patch

But it's not consistent. Files that fails seems to work fine after a codex restart. I never had this issue before, and only after upgrading to 0.118.0 in WSL2.

I asked Codex to look in the Codex logs, but i doesn't seem like the failed attempts are properly logged.

What steps can reproduce the bug?

I cannot reproduce it properly. Asking codex to apply_patch in a fresh instance works fine.

What is the expected behavior?

Apply_patch works like previous versions <= 118

Additional information

_No response_

View original on GitHub ↗

3 Comments

github-actions[bot] contributor · 4 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #16402
  • #16407
  • #16311
  • #16102

Powered by Codex Action

root-oath · 4 months ago

Same issue in running codex in a vscode remote container (alpine). Codex just asking me to loose the docker permission...

Ltbltbltbltb · 4 months ago

Same issue here.

Environment:

  • codex-cli 0.120.0
  • Linux 6.6.87.2-microsoft-standard-WSL2 x86_64
  • Node v20.20.0
  • Windows Terminal (WSL2)

The apply_patch fails intermittently (~30% of the time) during longer sessions. Restarting Codex resolves it temporarily. Started noticing this after upgrading past 0.117.x. Same behavior as described in the original report — files that fail work fine after a fresh restart.

Showing cached comments. Read the full discussion on GitHub ↗