Skip to content

Commit f2ffe26

Browse files
authored
fix: add instruction to use valid SEARCH/REPLACE markers when diff edit fails (RooCodeInc#3776)
* fix: add instruction to use valid SEARCH/REPLACE markers when diff edit fails * Create proud-trains-give.md
1 parent fbe57b2 commit f2ffe26

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.changeset/proud-trains-give.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"claude-dev": patch
3+
---
4+
5+
fix: add instruction to use valid SEARCH/REPLACE markers when diff edit fails

src/core/prompts/responses.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ Otherwise, if you have not completed the task and do not need additional informa
196196
`${newProblemsMessage}`,
197197

198198
diffError: (relPath: string, originalContent: string | undefined) =>
199-
`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` +
199+
`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` +
200200
`The file was reverted to its original state:\n\n` +
201201
`<file_content path="${relPath.toPosix()}">\n${originalContent}\n</file_content>\n\n` +
202202
`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.)`,

0 commit comments

Comments
 (0)