Roo-Code: Unable to apply diff to file - contents are out of sync
Which API Provider are you using?
Google Gemini
Which Model are you using?
gemini-2.0-flash-exp
What happened?
First off, outstanding piece of software. This is hands down the best AI codign experiecne I’ve had. Just discovered you after using the frustration that is windsurf, and man this is like a breath of fresh air, not to mention how accurate it is. So well done, keep up the good work. I’ll contribute if I can, or maybe you should start a donation fund. I’d happily sling you some $$
So…
I don’t think it’s model specific, but if I have updated a file directly it gets this error and goes into a loop trying to read it. If it’s trying to edit and it gets the error, eventually it decides to not use the diffs and write the whole file which gets it out of the loop, but reading doesn’t seem to have a mechanism for this.
Unable to apply diff to file - contents are out of sync
I apologise I’m not 100% sure this is just edited files, maybe just large files, but definitley seems to be to do with handling the diff editing option. I’ve certainly thought, “hang on I haven’t even looked at that file.”
It’ll do about 3-5 loops then say
"It seems like I’m still having trouble applying the diff to the design-system.md file. I will try using write_to_file to overwrite the entire file with the updated content, similar to what I did with the README.md file earlier.
First, I need to read the file content again to make sure I have the latest version."
then goes back into the same loop while it tries to read the file again
Steps to reproduce
- edit a file while you’re in an active flow/chat
- ask it to update that file
Relevant API REQUEST output
apply_diff for 'docs/design/frontend/design-system.md'] Result:
Error applying diff to file: /Users/fridaystreet/dev/docs/design/frontend/design-system.md - contents are out of sync. Try re-reading the relevant lines of the file and applying the diff again.
<environment_details>
# VSCode Visible Files
(No visible files)
# VSCode Open Tabs
(No open tabs)
</environment_details>
Additional context
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 18
Commits related to this issue
- Make orgId nullable (#113) — committed to RooCodeInc/Roo-Code by cte a year ago
I did just merge https://github.com/RooVetGit/Roo-Cline/pull/120 and am releasing it as we speak in 2.2.8, so maybe that will help. I’ll look at your export though - thanks for that!