VS Code's file changes watcher stopped working

Viewed 2347

I have vsc version 1.63.2. I'm getting the following notification:

"File changes watcher stopped unexpectedly. A reload of the window may enable the watcher again unless the workspace cannot be watched for file changes."
notification

When I click the reload button, the issue is temporarily fixed and Source Control shows changes to my files. Git in CLI is working fine; git log --raw shows changes to my files correctly. I've tested brand new and old repositories and workspaces. The problem occurs in all of them. Any help troubleshooting this is greatly appreciated!

3 Answers

I just ran into this issue today and found my solution by viewing the "Window" logs using the "Developer: Open Log File..." command from the Command Palette.

In my case, the problem was that I had added a folder to my workspace that I had since deleted on the file system. The log in question looked something like:

... [error] [File Watcher (parcel)] Unexpected error: Invalid handle (EUNKNOWN) (path: \path\that\no\longer\exists)
... [error] [File Watcher (parcel)] restarting watcher after error: Invalid handle

Hopefully viewing this log helps you find out what's breaking in your specific case.

TLDR : on Windows 10, if you have Cygwin64 installed and you got a Git For Windows update, check Git for Windows path comes before Git from Cygwin path in environment variables.

Long version : Just got into the same error today. The Git Lens extension was not working anymore. I'm on Win 10, so there is no way (at least I didn't find one) to increase the limit of watchers like on linux. My VS Code is v1.66.2, Git Lens extension is v12.0.6. In my case, the logs said :

... [error] [File Watcher (parcel)] Unexpected error: Invalid handle (EUNKNOWN) (path: cygwin\g\path\that\exists)

Notice that ENOSPC !== EUNKNOWN

So I searched everywhere with little to no success, except here where Gordon Christopher Weeks's answer actually hinted me towards that logs. Then I remembered several things :

  • I have a terminal installed that's called cygwin64 and that allows me to use some linux utilities otherwise not available on Win (like rsync);
  • two days ago, I authorized an update for Git for Windows (2.35.2);
  • when I installed cygwin, the tutorial I followed told me about following a certain sequence in the Windows path environment variable

So I checked the path variable, noticed the Git update deleted the initial path to git and put it in the last place. I only had to move it up, before the cygwin64 path to git.exe (a git utility is included with cygwin) and everything's back to normal.

Hope this helps and so you won't waste the time I did !

I also encountered this problem. I was using VSCode and opening a folder in it on WSL Ubuntu 20.04. The solution for me was to install the VS Code Remote - WSL extension.

I hope this will be useful for someone.

Related