edit_block issue
I pulled the latest updates and using it to test.
Seems like all my edit_blocks ending with a result similar to this:
"Exact match not found, but found a similar text with 98% similarity (found in 11806.07ms):\n\nDifferences:\ndef
then it tried read_file and fix itsefl but at the end it does write_file
Some files are not even that big like 300 lines etc
Just fyi, there might be a problem
Thanks for sharing so quick, usually you will see this message when there is no exact match for a searched string. How big is you file where it did this? bcs 11 seconds is a lot of time for searching inside the files, if the file is 300 lines.
@esayli can you share your OS, the prompt and the file where edit failed? We ahve problem to reproduce this issue in our env
I get the same. Using it on Claud and the file is hardly 300 lines of code. On windows.
I came here with a suggestion but I can also perhaps give you a hand in reproducing this issue whenever Claude reaches a max message limit and he is halfway through a write file operation. I'm in the habit of copying and pasting and saying to Claude, "Hey, I notice you hit a max message limit. To make things easier for you, I have copied and pasted 128 pages of lines of code to that file you were editing. Use the edit_block tool to append to the end of the file. The end of the file looks like this: [insert code block here]. "
Sometimes this approach works and sometimes it fails with a 99% match.
My suggestion is to make the edit block tool white-space insensitive, as while LLMs can be good at preserving context, they don't handle an exact replication of whitespace very well.
Alternatively, other implementations similar to edit_block have a user-configurable percentage acceptability, eg, "if the match is [95]% or more, then proceed with the replacement". I would enhance that by adding an optional "[AND it's the only match that exceeds [95]%]".