Failed to apply patch to repo. This can happen if the setup script and agent modify the same files

I’ve just added a project to Codex. I ask it to do something and it pops up with a log sayins it’s prepaing the environment. Then shows this error: Failed to apply patch to repo . This can happen if the setup script and agent modify the same files.

I have nothing else running concurrently. How do I solve?

1 Like

Same here… Makes Codex unusable

Same problem. I can’t continually work on an issue in the same PR. Instead, I have to open a new PR and branch every time I need to review a fix that didn’t work, cluttering up my repo. This essentially means Codex is not the right fit for my platform, unfortunately.

sorry no sollution… had same when using codex on my phone during vacation..

What are you using.. mobile phone | normal browser ..

and what langauge is your codex working on.. mine was Python when it gave those errors,
my rust projects not gave these warnings yet..

my solution was simply .. drop the chat to history.. and start over again.
then again.. i work with simple .. commands …

  1. Add todo list items for … [task]
  2. Execute coding tasks from todo list

after that is repeatedly use the following.
3…x Replace mock code with implementation

when it says it has no tasks to do … i make the push…
specially replace mock code… helps to fix the lazy cheating basterd it is :stuck_out_tongue:

if run into the preparing environment .. i count how far it takes .. and try to make a push early…
its like debugging and tracing manually with codex…

that helped for me and now in a stage where i can make lots of todo items again…

Isn’t this happening because you forgot to push your code? I noticed this is happening when I commit code, forget to push, and try to start another task from within VS Code.

2 Likes

This is making Codex entirely useless…. You don’t even tell us what file and the logs are useless so we’re left to guess like idiots until it works - then it maybe works for one turn and you’re back at it.

Give us some useful feedback or it’s Claude Code for me. I’ve now wasted an entire day on this.

Thank you, yes that was it for me.

Yes, but this misinterprets the issue. Codex often produces wrong results that you want to iterate on and fix “before” pushing it to the repository, rather than stacking on bug after bug. Having it suddenly just break while doing this isnt helpfull.