Search and Replace Tool Failing Constantly with Formatting Issues


Search and Replace Tool Call


Edit_File Tool Call

I noticed when Claude uses the Search and Replace tool call, the formatting is mangled; but when I tell it to use the edit_file tool, it works perfectly fine. So, I assume the issue is with this new tool call?

Version: 0.50.6 (user setup)
VSCode Version: 1.96.2
Commit: f3f2ad556456ff2df80332923bb1e2a818110d10
Date: 2025-05-23T02:42:52.592Z
Electron: 34.3.4
Chromium: 132.0.6834.210
Node.js: 20.18.3
V8: 13.2.152.41-electron.0
OS: Windows_NT x64 10.0.26100

4 Likes

Claude Sonnet 4 mangles formatting in Cursor. I’ve seen it too. Haven’t used Opus as much so can’t confirm. I should also add that applying the code manually works perfectly. It’s only the agent’s tool calls that seem to get “mangled”.

1 Like

Thank you! I forgot to mention that, but yes if you select the “Apply” button it will properly apply the code. That is one workaround to it right now. And I did notice it seems to be only Claude, not just Claude 4 sonnet but 3.7 too. Haven’t thoroughly tested with other models.

I made this correlation because the search and replace tool was introduced not too long ago and after this tool was introduced, Claude started destroying the formatting, and when I ask it to use the edit_file tool it works perfectly fine.

Hey, sorry about this!

The search and replace tool has been disabled while we iron out the kinks, so everything should be back to normal (you may have to start a new chat!).

1 Like

That’s okay! Thank you for the swift response and working it out, we appreciate it.

1 Like

Thanks! Opus 4 seems to have no issue using search and replace perfectly, but Sonnet 4 is barely getting them right atm

1 Like

Appreciate the feedback!

2 Likes