Cursor is asking me to edit the code

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

For the last few months Ive been able to get Cursor to do all the coding without a problem. The last few days it has hit a problem and it’s asking me to edit the code.

Basically it’s saying it can no longer use ‘apply_patch’ to edit even the simplest lines. It can read, and tell me what code there is, and then tell what to change but it can’t change it itself.

In Cursors own words Cursor has written out what the problem is, which is as follows (Obviously there are references to specific files for my project)

"## 3. What’s Going Wrong with apply_patch

3.1 Symptoms

  • read_file consistently returns the correct code for AddFilamentViewV2.swift and other files.
  • When the assistant tries to call apply_patch with a diff that:
    • clearly matches what read_file just showed,
    • and only changes a small section (like the addUserDefinedColor() function or a single brand list line),
      the tool fails with:

Error calling tool: There was an error applying the patch, and it was NOT applied.
Failed to find context: <snippet>

  • This has happened for:
    • AddFilamentViewV2.swift (multiple times),
    • FilamentCatalog.swift (brand list line),
    • Previously, HomeView.swift during other sessions.

3.2 Why this is surprising

  • From the assistant’s perspective, we can:
    • call read_file and show the exact surrounding lines,
    • see that the text in the file matches the context we intend to patch.
  • However, apply_patch appears to have its own internal context‑matching logic and refuses the patch unless the “before” block matches exactly (including whitespace, line breaks, and any hidden characters).
  • In this project, even after re‑reading the file immediately before patching, apply_patch is repeatedly returning “context not found” for very small diffs.

3.3 What we suspect

  • This appears to be a limitation or bug in the current apply_patch integration rather than:
    • a malformed patch (the diffs themselves are straightforward),
    • or user edits racing the AI (the failures occur even when the user has not touched the file between read_file and apply_patch).
  • It may be related to:
    • very large Swift files (AddFilamentViewV2.swift is ~3k lines),
    • or line ending / whitespace differences that the assistant’s view of the file doesn’t fully capture.

can anybody assist? This is slowing me down!

Steps to Reproduce

Prompt Cursor to make a change to code. Cursor tells me it cant due to a limitation that has never come up before. Ive tried reinstalling the Mac OS app, but is still an issue

Expected Behavior

Cursor is meant to be able to edit the code without an issue!

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

Version: 2.1.46 (Universal)
VSCode Version: 1.105.1
Commit: ab326d0767c02fb9847b342c43ea58275c4b1680
Date: 2025-12-02T03:59:29.283Z
Electron: 37.7.0
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Darwin arm64 25.0.0

For AI issues: which model did you use?

Auto

For AI issues: add Request ID with privacy disabled

9607311a-9f8d-4a71-9afd-e5f2c8902144

Does this stop you from using Cursor

No - Cursor works, but with this issue

ok - it would seem as though it was an issue on the Cursor server side, today this is working fine now. Learn something new each day.