Duplicates the file contents at the top

I am working on a flask, HTML, javascript, css project. I am seeing this issue that for some files, when it applies changes to the file after giving a response in the composer, it ends up in simply duplicating the contents of the file at the top of the file, but not all the contents. This duplication starts at the top and seems to abruptly stop in the middle.

This was happening on styles.css first consistently, and then now it is started to happening on scripts.js but not so consistently. I think it happens after reaching certain size.

I am suspecting that while applying the changes, it prepares the file contents in a buffer, and then it intends to copy to the file, but while doing so it crashes in the middle, so it leaves the file as if it is half-duplicated at the top.

When this happens, I have to reject all changes and go to the file tab in the composer, and look at the changes and manually add them in. This is super annoying.

Has anyone else noticed this?

yes it happens to me, using chat, apply changes, repeats parts of the top of the file,

had to go back and keep deleting things it was repeated

Glad to see someone else is having this issue too. But I was hoping to get more people calling out about this. Are people keeping the file sizes shorter, or they are simply working on mostly very small projects.

It’s happening from 3 weeks. People complained but no response from cursor team unfortunately.