Compare commits

...

2 Commits

Author SHA1 Message Date
Saoud Rizwan 5a8ec4bd86 Create proud-trains-give.md 2025-05-23 09:44:35 -07:00
Saoud Rizwan 6b5813dd58 fix: add instruction to use valid SEARCH/REPLACE markers when diff edit fails 2025-05-23 09:41:55 -07:00
2 changed files with 6 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"claude-dev": patch
---
fix: add instruction to use valid SEARCH/REPLACE markers when diff edit fails
+1 -1
View File
@@ -196,7 +196,7 @@ Otherwise, if you have not completed the task and do not need additional informa
`${newProblemsMessage}`,
diffError: (relPath: string, originalContent: string | undefined) =>
`This is likely because the SEARCH block content doesn't match exactly with what's in the file, or if you used multiple SEARCH/REPLACE blocks they may not have been in the order they appear in the file.\n\n` +
`This is likely because the SEARCH block content doesn't match exactly with what's in the file, or if you used multiple SEARCH/REPLACE blocks they may not have been in the order they appear in the file. (Please also ensure that when using the replace_in_file tool, Do NOT add extra characters to the markers (e.g., <<<<<<< SEARCH> is INVALID). Do NOT forget to use the closing >>>>>>> REPLACE marker. Do NOT modify the marker format in any way. Malformed XML will cause complete tool failure and break the entire editing process.)\n\n` +
`The file was reverted to its original state:\n\n` +
`<file_content path="${relPath.toPosix()}">\n${originalContent}\n</file_content>\n\n` +
`Now that you have the latest state of the file, try the operation again with fewer, more precise SEARCH blocks. For large files especially, it may be prudent to try to limit yourself to <5 SEARCH/REPLACE blocks at a time, then wait for the user to respond with the result of the operation before following up with another replace_in_file call to make additional edits.\n(If you run into this error 3 times in a row, you may use the write_to_file tool as a fallback.)`,