Edit_file failure makes model decide to delete file then recreate which always fails

edit_file fails a lot.
It especially fails when

  1. File is large
  2. Modification is done on top of another modification on the same area of code in single response (not whole chat just single response the model is trying to solve my issue)

Failure is one thing, but cursor’s (or model’s) solution sometimes is to delete file and try to replace the whole thing. I try to suppress it with prompt but occasionally throws it in regardless.

If the model is capable of doing things properly I would be fine, but almost 10/10 it fails and just leaves empty file.

Please resolve

Hey, with which model is this happening? Also, could you share the request ID? First, disable the privacy mode, then reproduce it. Also, let me know which version of Cursor you are using.

Version: 0.50.7 (user setup)
VSCode Version: 1.96.2
Commit: 02270c8441bdc4b2fdbc30e6f470a589ec78d600
Date: 2025-05-24T18:32:30.918Z
Electron: 34.3.4
Chromium: 132.0.6834.210
Node.js: 20.18.3
V8: 13.2.152.41-electron.0
OS: Windows_NT x64 10.0.19045

It is difficult to reproduce as it’s part of bigger request. Happens with Claude-4-sonnet-thinking.

1 Like