Cursor 0.41.xConfigFixed in 0.42.x
Cursor "failed to apply edit — diff did not match"
Error: failed to apply edit, hunk @@ -12,7 +12,9 @@ failed
- Affected versions
- 0.41.x
- Fixed in
- 0.42.x
- Last verified
- Cursor 0.42.0
Root cause
The file changed (formatter, another edit, or git) between when the model read it and when the edit applied, so the diff anchor no longer matches.
How to reproduce
Have format-on-save on, ask for an edit; the apply fails intermittently.
Solutions (2)
Ordered by community votes. Always check the verified version before applying.
39
#1Applies to 0.41.x
Disable format-on-save (or set it to run after AI edits) so the file isn't reformatted between read and apply.
Last verified: Cursor 0.42.0 · community
18
#2Applies to 0.41.x – 0.42.x
Re-send the request so the model reads the current file state, then apply immediately.
Last verified: Cursor 0.42.0 · community