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.