Bug for "string to replace was not found in the file" and "Message code block not found

Guys it’s impossible to work! Cursor continue to say “string to replace was not found in the file” and “Message code block not found” in agent mode!
Then it try to create a new file in loop…

5 Likes

I get this some times as well, highly annoying (Cursor 0.51.1 Windows, Claude 4 Sonnet)

Getting the same issue on agent mode claude 4.0 sonnet.

i’m also getting the same issue with agent mode 4.0 sonnet

thats all I’m getting all day today.
The string to replace was not found in the file.

The only work around is setting it to AUTO mode, which I assume is not using claude.

I also encountered this problem when using claude 4.0 sonnet. It only appeared when editing certain scripts. After a certain C# script appeared once, the AI ​​model could no longer edit or modify it. Every time the AI ​​model wanted to edit or modify it, “Message code block not found” would appear immediately. I feel that it may be a bug in the local cache of script modification history. This bug greatly affects my usual work of using Cursor to repair code. I sincerely hope that the official team can fix it as soon as possible.

1 Like

I am still experiencing this issue. Why is the Cursor team not resolving this issue or offering an alternative solution? My work has been interrupted due to this issue.

@enesilhaydin hi, this is not a common issue and depends on the model as well. Please create a separate thread as full Bug Report so it can be analyzed and the cause determined. Cursor Team is looking into detailed bug reports for such issues to fix. Be detailed there, which model you use, … add a Request ID if you can temporarily disable privacy so Cursor Team can look what happened between the steps.

The goal is to find the cause and fix it.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.