Creating a new file rather than updating the exsiting one

this is a weird one, not seen this issue before.

i ask for a suggestion of say index.html (as an example, not actual) it gives a suggestion, i click apply, and it creates a new index.html at the root rather than deal with the index.html in the public folder that it just read… (the only index.html file)…

… so frustrating… not sure why Cursor is doing this… It happily edits some files, but arghghghghghghghghghghghghghghhghg

4 Likes

At the root of the folder you have open in Cursor? Or at the root of your disk?

Any chance you could send a screenshot? This start to give us a sense of where this is happening (chat/composer) and whether there’s some context issue with how we’re showing things to the AI.

I’m also getting this

I’m getting the same issue, so annoying

Try turning this setting off.

Do you think it’s related? These settings are for the Composer, not the chat. I’ll check it out, thanks for the tip.

1 Like

I want to bring attention to this. It worked before. Now it is broken. There are more threads on the topic and in my mind this breaks the experience a lot.

These are just two recent ones, are a lot more if you search.

Cursor chat no longer applying code changes to correct files. Also bugs out and doesn't allow for the suggested code to be applied

1 Like

Here is an example of it happening. Clearly it should add the changes to “MainArea.js” but instead it creates a “MainArea.js” outside the existing folder structure. And it even create new folders as well.

I also have this issue, it totally kills the flow of updates as you have to either copy, which is not easy as the chat window escapes out sometime when ``` is present, or you have to repeatedly ask it to apply to the path of the specific file.

Anything that can be done to solve this would be massive. You must be able to see this from people cancelling updates that are created in a new app or src folder in the root of the project.

Pleas help…

1 Like

I found some more. There is some error with the disk write. I got to this place after following a modal that I can’t change the file. Maybe it is a clue?

Working Solution for me - as of 1 Nov
I just turned of the allow edit outside of context, forced an update to Cusor and changed to o1-mini and it started working again. Will report if it sticks or breaks with other models. But maybe this can help others :slight_smile:

I also encountered this problem when I started a new project. I created a folder, opened it, and then used the editor to create a subfolder within the first folder. I began setting up the code structure. Once I had all the files and folders in place, I started using Claude, and the mentioned problem occurred, just as someone else had described. Even though clicking on the file in the chat correctly identifies it, pressing ‘apply’ creates a new file with folders.

Here’s my solution: Instead of opening the first folder I created, I opened the second folder inside it, and voilà, it worked.

1 Like

This is still broken & has caused me to stop using cursor until a fix is implemented.

It is without a doubt the #1 issue this app has right now as it renders it completely useless.

I was also having this issue but 0.42.4 became available not long ago and I havent experienced it since updating :smiley:

1 Like

Also have the same issue. At first I thought it was something to do with me messing up some config (it has been working fine for months in the project I am working on, but stopped working a few days ago).

It’s a total pain because you can’t even just copy the output from the chat because often the suggested code is a delta on the underlying code.

This really needs a fix!

Here is the fix for now guys.

I came up with a prompt that you paste into your claude chat & it’ll fix it.

CURSOR DEVS PLEASE HARD CODE THIS INTO THE MODEL. CURSOR IS BROKEN UNTIL YOU FIX THIS!

"You are creating new files instead of adhearing to our already pre-exisiting project structure and files.

[YOUR MAIN FOLDER] is the main folder
[YOUR ROOT DIRECTORY] is the root directory and src is the main folder with our important files

You are editing files within a project where the existing src folder is located in the root directory of my project. Please make sure that any code edits you suggest are directed at the files within this existing src folder and do not create a new src folder. Make sure you only refer to or create files within this pre-existing src directory. Do not create or reference any directories outside the existing src structure, and verify that all file paths reference this specific directory. Thank you."

Also Having this problem