VS Code Failed to create file handle: Access is denied

VS Code Failed to create file handle: Access is denied

Recently in Windows, while running VS Code primarily from Windows vs. WSL, I started encountered an error “VS Code Failed to create file handle: Access is denied” tl,dr; Relaunching VS Code as Administrator and checking for updates was the magic formula in my case.

I encountered a possible solution on Reddit which suggested making sure that AppData\Local\Programs\Microsoft VS Code was writable by the user.

No sure luck on that one. But I canceled out of the upgrade and saw a reference to a file to the effect of C:\Users\username\AppData\Local\Temp\vscode-inno-updater-1659730976.log which pointed to several attempts to access C:\Users\username\AppData\Local\Programs\Microsoft VS Code\bin\code. I first trying renaming the file and then deleting it. Then code.cmd in the same folder was complained about.

I ultimately ended up restoring those files.

I finally went back and retried running VS Code as Administrator and checking for updates. This time the updates worked.