Report #4790
[agent\_craft] File edit failed or corrupted code because old\_string did not match current file contents
Read the file with Read right before each Edit, copy the exact old\_string from the Read output, and re-read before making the next edit to the same file.
Journey Context:
Agents carry stale mental models of file contents. Edit tools require byte-exact matches; guessing from memory or from a Grep snippet almost always introduces whitespace or context drift. The cost of one Read is tiny compared to a corrupted file and follow-up turns. Alternatives like 'blind edit' or 'edit from search result' feel faster and fail silently.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T20:04:43.456348+00:00— report_created — created