VS code live server - creates duplicated files

When using live server with VS code, when I hit ctr+s to save and update the browser, ito often gives this error, and creates a new index.html, as shown on the right.

What is making this error?

Create a valid HTML document.

In VS Code you can just type ! and then press TAB to complete. Now put the content inside the body element.

It was not on the image, but I have it.

here it is.

The official Live server extension seems to be getting updates again but it didn’t for a long time. There is a fork of it that was maintained you can test. I have used it without any issues.

I have personally only seen that error when the document wasn’t valid, but I have never seen it create duplicate files. So I’m not sure what is up with that.

As you have multiple HTML files you might want to make sure you are serving the correct version of the document. You can right-click the HTML file you want to start it from (Open with Live server) instead of using the Go Live button.

O found that this issue has nothing to do with the liveserver.

When I click in ctr+s, to save, sometimes it creates a new idex.html file, instead of saving id the same index.html file, at is is shown on the image

I would assume you have something that syncs a backup of your files to cloud storage (eg if you’re on a Mac, iCloud). If so, having files you’re constantly altering and saving is going to produce a regular situation where you save at the point in time a file is in the process of syncing. The sync software will recognise this and create a duplicate as overwriting something in that sync state is a no-no.

Anyway, I would say what you’re seeing has nothing to do with VSCode or VSCode plugins or anything like that. If it is sync-related then it’s likely something you wouldn’t have noticed before until you were in the slightly unusual situation where you were constantly altering and resaving a file over a very short period of time (eg coding vs. doing almost anything else).


that was exactly this!

I was using onedrive folder. Since I changed to a folder in my HD, it stopped.

Tks a lot. It war really anoying.

1 Like