Failed to apply patch consantly

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

What version of the Codex App are you using (From “About Codex” dialog)?

104

What subscription do you have?

200$

What platform is your computer?

Linux 6.17.0-14-generic x86_64 unknown ubuntu

What issue are you seeing?

codex hits failed to patch CONSTANTLY, even so on version 102 it was Never,. I litereally have never seen it.

I’m moving to implementation now: adding a dedicated live open_search extractor that targets the 5 requested sections and writes a readable HTML
document report. I’ll also include downloaded filename/extension in extraction metadata so the report can show which document format was parsed.

Search text_extraction|open_search|downloaded_filename|text_source|_extract_opened_document_text in tests

• Edited mcp_tools/e_court/src/tool_tree.py (+2 -0)
4119 filename = f"document_{index}"
4120 + meta["downloaded_filename"] = filename
4121 + meta["downloaded_extension"] = Path(filename).suffix.lower()
4122

✘ Failed to apply patch
└ execution error: Io(Os { code: 2, kind: NotFound, message: "No such file or directory" })

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

• I’m making a small metadata patch in tool_tree so each extracted document includes filename/extension in the report. Then I’ll add the dedicated 5-
document HTML runner.

• Edited mcp_tools/e_court/src/tool_tree.py (+2 -0)
4119 filename = f"document_{index}"
4120 + meta["downloaded_filename"] = filename
4121 + meta["downloaded_extension"] = Path(filename).suffix.lower()
4122

✘ Failed to apply patch
└ execution error: Io(Os { code: 2, kind: NotFound, message: "No such file or directory" })

• Ran pwd && ls -la mcp_tools/e_court/src/tool_tree.py
└ /home/william3/Desktop/projects/site-deepresrach/deepresearch
-rw-rw-r-- 1 william3 william3 237101 Feb 19 16:45 mcp_tools/e_court/src/tool_tree.py

• Edited mcp_tools/e_court/src/tool_tree.py (+2 -0)
4119 filename = f"document_{index}"
4120 + meta["downloaded_filename"] = filename
4121 + meta["downloaded_extension"] = Path(filename).suffix.lower()
4122

✘ Failed to apply patch
│ tool_tree.py
└ (no output)

• Explored
└ Search downloaded_filename|downloaded_extension in tool_tree.py
Read tool_tree.py

What steps can reproduce the bug?

I use 5.3 xhigh, 104 version of cli codex.

What is the expected behavior?

_No response_

Additional information

_No response_

View original on GitHub ↗

15 Comments

github-actions[bot] contributor · 5 months ago

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

  • #11606

Powered by Codex Action

miniq15 · 5 months ago

mention my thread ID 019c76a9-3e43-7881-b5c1-81d2ec9ca869 in an existing issue.

miniq15 · 5 months ago

Update: downgraded to 0.103, it works again !!

etraut-openai contributor · 4 months ago

We haven't heard of this issue from any other users, so there must be something specific about your system or configuration that's causing it.

Do you have any non-default configuration settings in your config.toml file?

I reviewed your log file. You said that you were having problems when running 0.104.0, but the log file contained logs for 0.103.0.

StevenShen3641 · 4 months ago

Same issues here after upgrading to 0.105.0

etraut-openai contributor · 4 months ago

@StevenShen3641, please use /feedback to upload your logs and session details and post the thread ID here. Without this information, we don't have enough information to investigate further.

StevenShen3641 · 4 months ago
@StevenShen3641, please use /feedback to upload your logs and session details and post the thread ID here. Without this information, we don't have enough information to investigate further.

Hi,

Thanks for the reply!

The error conversation using codex v0.105.0: 019c9dec-8979-7e60-aca7-beb012173479

The compared conversation using codex v0.81.0 with the same user prompt: 019c9e6f-bfcc-76d1-96eb-b2bed13fe49d

FYI, I am using gpt-5 with codex to do some evaluation. But similar behavior also happens on 5.1-codex and 5.2-codex, which I believe is a bug introduced in some latest version. This phenomena appears for almost half of our evaluations.

The bug seems to be the model keeps using terminal command "applypatch" and fails, and finally, it create some python files under /tmp to apply the patch.

This leads to two consequences:

  1. the model does not use the agent provided tools such as apply_patch and other file edit tools, which will not emit item that represents a file edit happening (or proposed) during a turn. It would be hard for developer to find which file is modified by the model, but not by other stuff (e.g., file change during compilation);
  2. the model keeps failing apply the patch. See items 24 to 41. This leads to unnecessarily extensive token consumption. While this conversation cost 1.51 dollars in total, the same user-prompt using codex v0.81.0 only cost 0.26 dollars.

A possible reason could be: At the start of the conversation, codex failed to feed in the system prompt which contains codex built-in tools.

jif-oai contributor · 4 months ago

Checking

jif-oai contributor · 4 months ago

@miniq15 on 019c76a9-3e43-7881-b5c1-81d2ec9ca869 I can see some successful apply_patch and I don't see the errors you mention

@StevenShen3641 we disabled apply_patch for gpt-5 in December because the model was not trained on it

StevenShen3641 · 4 months ago
@miniq15 on 019c76a9-3e43-7881-b5c1-81d2ec9ca869 I can see some successful apply_patch and I don't see the errors you mention @StevenShen3641 we disabled apply_patch for gpt-5 in December because the model was not trained on it

Hi,

Thanks for the reply! This is weird, since for later version such as 0.93.0 in Jan, the model can apply the patch successfully for almost all conversations. And in some of the conversations in 0.105.0, the model could apply the patch using built-in tools as well. Is it disabled on Codex side?

jif-oai contributor · 4 months ago

@StevenShen3641 the model does not see the tool but it can still "remember" how to use it based on his training

hackermirror · 4 months ago
@StevenShen3641, please use /feedback to upload your logs and session details and post the thread ID here. Without this information, we don't have enough information to investigate further.

019d1648-017b-70f1-958c-22161c073aa8

veilm · 3 months ago

I was seeing this consistently today with gpt-5.4 high. I don't have a /feedback for reference because the codebase is sensitive, but anecdotally I think it may have started, in my previously open codex instance, around the time I upgraded codex through npm in a new terminal.

Closing that failing codex instance and using codex resume to start it again, seemed to fix it; I didn't see any ✘ Failed to apply patch after that

miniq15 · 3 months ago

i know the issue.
it is because you can have a session THEN if you leave it , update code to newer version then you come back to the session you will have 100% of failed to apply patch.