Vscode: Failed to save ...: The content of the file is newer. Please compare your version with the file contents.

Created on 15 Jul 2019  路  6Comments  路  Source: microsoft/vscode

  • VSCode Version: 1.36.1
  • OS Version: openSUSE Leap 15.0

Steps to Reproduce:

  1. Change git branch
  2. Change file, try to save in new branch
  3. One out of 20 times get the error :)

It is extremely frustrating seeing this from time to time! I have to open another editor/IDE in order to make my changes.

file-watcher needs more info

All 6 comments

Just worked through this with an Intern, sporadically they would be unable to save changes to anything that wasn't a css document, then this morning they were unable to save anything.

TLDR; Completely remove all vscode installs & install vscode insiders.

Speculated it could be a clock issue, resources issue, or general bug.

Originally thought it was an issue with their working directory being on the Network and their device clock wasn't in sync. We updated the Linux Mint install to use our internal time server, this did not fix the issue.

Went on to look at resource usage, the Machine in use was recently detuned to 4G of ram from 8G, only consumes around 2.7G when in use. (Runs EMail, Vscode, LAMP stack and a Browser). Bumping back to 8G had no effect, mind you we had to shut down and restart and the issue still persisted.

Decided to update to the most recent version of Insiders. Started with a side by side install, and continued to have trouble saving. Completely removed Vscode and Insiders, then reinstalled Insiders.
A fresh install of Insiders fixed the issue.

EDIT: While it was fixed for a short period of time...

The Issue has just returned, another work around we've determined that works is to close all open files in the editor prior to changing branches.

This sounds like missing file events. Here is what likely happens:

  • you have a couple of files open
  • you switch branches and this changes each file that is opened
  • you continue to make changes to the file and try to save
  • this fails, complaining that the state has changed on disk but was not updated

May I ask:

  • does this only happen for dirty files or all files? Because non-dirty files should get updated automatically
  • does this happen for any file that is opened, or only the top most one in the stack of tabs?

Only happens with dirty files. Doesn't matter where the file is in the stack.

@mcarpenterjr but that is intentional. we prevent you from overwriting a change that happened after you started editing.

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!

This "feature" should be opt-in only. It's completely unexpected and frustrating behavior. When I save, it should save what's in front of me, period. Makes using git co . with VSCode impossible. :(

Was this page helpful?
0 / 5 - 0 ratings