There was an error while deleting a directory:
%LOCALAPPDATA%\Programs\Microsoft VS Code\bin
: the process cannot access the file because it is being used by another process…
Does this issue occur when all extensions are disabled?: cannot try this because installation is disabled/destroyed due to incomplete setup
Workaround: will go back to system installs instead of local user installs.
@sergiusignacius Can reliably reproduce this. Will check with him asap.
I had the same question, every time I update vscode(Windows 10 with user setup), I got this error.
Same issue here.
I'm not even able to delete %LOCALAPPDATA%\Programs\Microsoft VS Code\bin
manually :/
I tried disabling all Anti Virus/Protection software running on the system and the self-updater still fails.
OK. I was able to repro this in @sergiusignacius's machine. Weirdly enough, it repros 100% of the time when Skype for Business is running. It doesn't repro when Skype for Business isn't running.
Any of you guys have Skype for Business?
Investigating...
Any of you guys have Skype for Business?
I do
If you shutdown Skype for Business, does update work?
If you shutdown Skype for Business, does update work?
It works!
Though I had to kill Skype for Business from the task manager as quitting wasn't enough.
OK, great to know. Investigating...
I have the same problem. Quit or kill Skype for Business not working.
I don't have skype installed on this particular laptop (but I do have Teams) and I started to experience this problem a couple of days ago. Looking at processes with handle open on that file/folder structure I only see the Insiders update processes:
@carlocardella Your issue is another one: #47841
So what’s the ultimate resolution here? Seems like perhaps Skype may be the issue? Is there a working discussion with resolving this for that class of users for user install? Or just don’t do it? And should there be a published warning pre-user install to avoid it?
I am able to reproduce this issue with user setup on Windows 10 machine and solve it by closing Skype in Task Manager as well.
Just want to say that there are actually two different problems here (but only tracked by this issue).
One could definitely hide the second problem by making sure that the update never fails. But that is probably not the right solution and I suspect that there should be another issue tracking the second problem.
- Update fails
This. This is my case, here is log:
Dec 19 21:44:59.160 INFO Get file handle: "C:\\Users\\Kenya-West\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe" (attempt 1)
Dec 19 21:44:59.211 INFO Get file handle: "C:\\Users\\Kenya-West\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe" (attempt 2)
---- after another 14 attempts ----
Dec 19 21:46:01.176 INFO Get file handle: "C:\\Users\\Kenya-West\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe" (attempt 16)
Dec 19 21:46:08.518 ERRO Failed to create file handle: the process cannot access the file because it is being used by another process.
I tried to delete Code.exe
at %LOCALAPPDATA%\Programs\Microsoft VS Code\bin
, but Explorer says it is being used by System process (~excuse me what?~). How is this happened?
Some info:
Steps to Reproduce:
What I have tried (with no luck):
Code.exe
by tools: Unlocker, IOBit Unlocker, MalwareBytes FileASSASSIN.Additional info:
Same error and log messages were when I had 1.29.1, 1.29.0, 1.28.1 updates
I confirm that when Skype was active then the update was failing leaving the user with no installation of VS Code (Insiders in my case).
I confirm that terminating the Skype task from the task manager and doing the update works.
I agree with @euij , a failed tentative update shouldn't leave the system with no installation of VS Code forcing one to download again the app from the website. These two steps should be decoupled and be able to deal differently.
I have no Skype, Skype for Business or Teams open, but still can't have bin removed.
never was able to install an update since switching to the user install.
vscode-inno-updater-1546985554.log
I was unable to update VS Code this morning and exiting f.lux (https://justgetflux.com/) allowed VS Code to update.
I have this error msg.
I shutdown all Skype process and this work!
As a workaround, feel free to disable background updates: "update.enableWindowsBackgroundUpdates": false
. You'll still get updates, just not in the background.
I was unable to update VS Code this morning and exiting f.lux (https://justgetflux.com/) allowed VS Code to update.
I confirm that when Skype was active then the update was failing leaving the user with no installation of VS Code (Insiders in my case).
I confirm that terminating the Skype task from the task manager and doing the update works.I agree with @euij , a failed tentative update shouldn't leave the system with no installation of VS Code forcing one to download again the app from the website. These two steps should be decoupled and be able to deal differently.
I have f.lux installed, but I managed to update VS code finally after force quitting all Skype-related processes in Task Manager. (I don't use Skype myself, but I haven't removed it yet)
Ran into the same issue, reading through the comments I tried killing Skype before pressing Retry and the update completes successfully.
Although in the ideal case killing Skype should not be a requirement and VS Code should update properly regardless. There should be no reason for Skype to hold a lock on a VS Code owned file...
I use Microsoft process explorer to check which process locked bin directory. I found that system process had 2 handles for that directory. After killed Skype process, 1 handle gone. After killed Line application(a kind of messenger application from Japan), the last handle gone. Finally I finished VS Code installtion.
From https://github.com/Microsoft/vscode/issues/63396
I don't have Skype or Skype for Business install on my PC
Instead I got Microsoft Team, Outlook, Visual Studio, MSSQL, etc
I think the installer should not even try to delete anything before new version is installed or should backup and rollback if something fail.
It is very annoying as I need to reinstall VS Code every time I close it.
Version: 1.30.2 (user setup)
Commit: 61122f88f0bf01e2ac16bdb9e1bc4571755f5bd8
Date: 2019-01-07T22:54:13.295Z
Electron: 2.0.12
Chrome: 61.0.3163.100
Node.js: 8.9.3
V8: 6.1.534.41
OS: Windows_NT x64 10.0.17763
exiting f.lux and tried to update, it works
Run into this issue several times recently,
I don't have Skype for Business installed, but have Skype app installed from Windows 10 Store.
Process Explorer shows %LOCALAPPDATA%\Programs\Microsoft VS Code\bin
is used by system process.
I found the following skype processes in Task Manager:
Terminate the first two didn't help, until terminate the last one: SkypeBridge.exe, Process Explorer shows no process is using %LOCALAPPDATA%\Programs\Microsoft VS Code\bin
anymore, then hit retry, VS Code successfully upgraded.
Then reopen Skype app, Process Explorer shows %LOCALAPPDATA%\Programs\Microsoft VS Code\bin
is used by system process again, terminate SkypeBridge.exe
in Task Manger, recheck in Process Explorer, no more processes using bin
.
I've always had this issue on this Win10 install.
update.enableWindowsBackgroundUpdates
. Did not work.Code.exe
is locked.SkypeApp.exe
in task manager. Did not work.System
?I had this issue twice, and started before I installed unity and VS2017 with it.
Why delete whole bin folder? Why not delete all files in bin folder?
I face the issue, when SkypeBridge.exe is running, bin folder cannot be deleted, but any file in bin folder can be deleted.
Same issue here and caused by Skype Business. Each time an update is done, it raises the error. Then I must close Skype for Business to resume the update process and release the lock on the folder.
I faced the issue again and had to close both Skype for Business and Outlook 365 to unlock the update process.
I'm getting the same thing, closing Skype for Business (and terminating all the processes) did not help. Rebooting doesn't change anything, locked by System (PID 4) as soon as you boot up. Only way to update is to install a new version in a new folder.
Wow. I've had this problem for well over a year and can verify that closing f.lux (per @cbenard) on my laptop finally resolved this update issue for me.
Addendum: I noticed the same behavior with 1password - i.e. automatic updates of 1password.com failed because a file was being used by 'another process'. Closing f.lux resolved that issue as well - so this problem sounds more like an issue with f.lux or programs like f.lux.
No skype and no f.lux on my Windows, but I faced the issue again and again.
I have the same Problem.
Closed Skype (not business) processes Outlook and it didn't worked. Process Explorer did not show anyone having an handle, but neither Setup nor I could delete the folder.
I then closed my PowerShell and groove and it worked.
I don't know why PowerShell should held an handle on the folder, its current directory was some Directorys above it. But I don't see a reason why groove should be the culprit.
Killing Skype works for me
Killing Skype did not work for me, however shutting down OneDrive did the trick.
Wow. I've had this problem for well over a year and can verify that closing f.lux (per @cbenard) on my laptop finally resolved this update issue for me.
Addendum: I noticed the same behavior with 1password - i.e. automatic updates of 1password.com failed because a file was being used by 'another process'. Closing f.lux resolved that issue as well - so this problem sounds more like an issue with f.lux or programs like f.lux.
I'd say it's a problem on both sides, f.lux, onedrive, skype for business, etc, should not be locking other application directories, especially at a system level, but at the same time, there's something weird going on here, as it's only impacting this (and other Electron applications).
This is very annoying.
@tishion exactly same problem! The folder is being used by System process.
Looks to be similar to this reported issue with Squirrel https://github.com/Squirrel/Squirrel.Windows/issues/1431. That said, it looks like Squirrel is no longer being maintained, so even though this bug seems to exist in their update platform/process, it likely won't be fixed...
I suppose it will need to wait until there's a migration path set out for Election app updates to move to a new process/platform. Until then (and likely involving a re-install for us who can't shake this issue), it's probably not going to be fixed...
Stopping/Uninstalling Skype (UWP version from Windows Store) worked for me.
I don't use skype or skype for team. But I have some skype* process. When I kill them the issue is resolved.
I was unable to update VS Code this morning and exiting f.lux (https://justgetflux.com/) allowed VS Code to update.
Can confirm. Couldn't update to 1.34, killing uwp f.lux fixed the issue.
Don't have f.lux and skype. Just outlook and OneDrive. Killed both and I keep having the same problems. Any idea?? This is very annoying
Moreover, it seems that when the failure happens, the update program doesn't roll back the changes. I have to reinstall VSCode to the same location for continued usage.
Personally I haven't seen the issue at all since updating to Windows 1903
Closing Outlook fixed it for me.
Solved for me guys! I closed VK Messenger app and installation proceeded successfully! This app is Electron-powered, makes sense since most of these apps are running Eelctron v3 or v2 versions, at best. Almost no hope they will jump to v5 or newer...
So, probably, the best universal solution is to close every Electron app running on your PC!
So, probably, the best universal solution is to close every Electron app running on your PC!
@Kenya-West Skype, Skype for Business, Outlook, f.lux, etc are all non-Electron. In many cases, it's the UWP (f.lux) version of an app causing a problem. There's something wrong in Windows. I haven't had an issue since I stopped using f.lux (uninstalled) and just used Windows' built-in "Night light", which is inferior.
@cbenard ah yes, forgot about it - one important detail is missing. VK Messenger, in my case, is an Electron-based app downloaded from Microsoft Store, therefore it is UWP app and determined by UWP restrictions. New Skype is the app with the same conditions, they have many things and common.
Also one notice: this issue happens only with VK Messenger installed through Microsoft Store (UWP version). In addition, I have two laptops where VK Messenger installed as a classic app, there were no issues with VS Code updates (Skype UWP installed on both).
Sounds logical that there is some kind of bug in Electron-powered UWP apps or bug in a process that manages their resources. That explains why System process handle Code.exe
file during update, preventing update process of VS Code.
No thoughts about Skype for Business, Outlook, f.lux since I am not using them.
There's a problem in UWP apps, not Electron. f.lux isn't Electron. Neither is Skype. However, that's interesting that the common thread is UWP.
Neither is Skype
Are we talking about the same apps @cbenard? There are two Skype versions, currently: Skype UWP (old one, Windows 10 up to 1803) and the new Skype powered by Electron (since Windows 10 1809). I am talking about the Electron one.
the new Skype powered by Electron (since Windows 10 1809)
I wasn't aware Skype moved to Electron (my company moved to Slack), but there are other apps like f.lux that aren't Electron. The problem people have had seems to mostly be resolved by closing UWP apps.
Also, as another counterpoint, I have Slack installed as a "native" Electron app, installed normally (not from the store). It's never caused this vscode issue. It's Electron, but not UWP, but I've had UWP apps cause this locked file problem in vscode.
Closed Outook and Slack, clicked "Retry" in the error dialog and it installed fine.
I've been having this same issue.
Process explorer reported that the System process (PID 4) had 52 file handles open to the directory.
As soon as the file handles cleared, I was able to update successfully.
It's been 10 months now since the ticket was open. Just wondering if we have any updates on this? Thanks.
I have been seeing this issue for few months. It happens on my one Windows 10 laptop but doesn't happen on another laptop. I don't have Skype or OneDrive running. Although it complains that one process is holding the bin, I couldn't see the process directly from the task manager. And basically I have no way to debug and had to reinstall manually each time. Hope this issue can be resolved eventually and I may have to disable auto-update for now...
@tishion exactly same problem! The folder is being used by System process.
I've been experiencing the same thing on my new desktop computer (Ryzen 7, 16GB RAM, 512MB NVME, Win10 Pro). My laptop (i7, 16GB RAM, 1T NVME, Win10 Home) does not experience this, even though it is very similarly configured (software-wise). Downloading and using the Microsoft Process Explorer does not reveal anything using the vscode bin folder. However, on a whim, I kill off OneDrive, and this allowed the updates to take place without issue (Killing Skype did not work). My laptop continues to function normally even though OneDrive is enabled there.
I was able to update after first closing Outlook. Looking at all the comments, seems office products are somehow blocking the process.
DBeaver CE was causing the problem for me
This is super frustrating... why hasn't anyone mentioned "Citrix Workspace" ???!!! :-)
My Windows Process Explorer, like some other people have observed, displays only "System" as the process that owns the file handle to VS Code folder/files. That doesn't help!
Through trial-and-error, it appears it's Citrix Workspace
. After I shutdown that application, I can delete the files/folder C:\Users\xxx\AppData\Local\Programs\Microsoft VS Code
.
Today the issue cropped up again. I had to close both OneDrive AND Outlook this time.
I got even worse experience during the latest update. It moved all the files (except uninstallation files) to a dir named "_" and failed afterwards. It made vscode unusable. Had to uninstall and reinstall :(
I got even worse experience during the latest update. It moved all the files (except uninstallation files) to a dir named "_" and failed afterwards. It made vscode unusable. Had to uninstall and reinstall :(
In my case, it turned out the folder "_" contained the update rather than the old installation. After it had failed, I was able to copy its contents to its parent folder and thus have a fully updated application.
In light of this issue with the bin folder, might it be an idea to recode the installer such that deleting this folder is not necessary as long as it is empty? I imagine, that can save a lot of headaches from affected users.
I got even worse experience during the latest update. It moved all the files (except uninstallation files) to a dir named "_" and failed afterwards. It made vscode unusable. Had to uninstall and reinstall :(
In my case, it turned out the folder "_" contained the update rather than the old installation. After it had failed, I was able to copy its contents to its parent folder and thus have a fully updated application.
In light of this issue with the bin folder, might it be an idea to recode the installer such that deleting this folder is not necessary as long as it is empty? I imagine, that can save a lot of headaches from affected users.
May be I misunderstood the content inside the "_" folder. I assumed it was an older installation, didn't actually confirm.
Copying the files from the "_" folder into the parent folder (and overwriting whatever files left there) allowed me to launch VS code again, without having to reinstall it. I then checked for update and installed it (made sure that Skype for Business was shut), and this went fine.
I somehow solved this issue by going inside the "_" folder and making a shortcut of "code.exe" and using it as goto.
Closing Citrix Receiver and Connection Manager fixed it for me.
Shutting down f.lux solved this issue for me.
Getting same issue now. Closing adobe creative cloud and slack fixed it for me.
Getting the same issue, none of the above solutions are working for me.
Closed down a variety of apps until it eventually works.
Someone try using Process Explorer as administrator to see what's locking the directory: https://docs.microsoft.com/en-us/sysinternals/downloads/process-explorer
This happens to me every time I close VS Code- it starts to update, fails, and then uninstalls VS Code. I have none of the previous programs mentioned that may interfere, and am on a Windows 10
I am having the same issue. Need to re-install VS code 3 times. At least it keeps the settings and the extensions. @echuber2 I am not expert in using the process explorer. Below is the screenshot of what is see when I searched for code.
[SOLVED] I had same issue, but with '\resources' folder. What I did to solve was install IObit Unlocker Software and when the error happen, I use the IObit to unlock & delete the folder and than I "Retry" the update process. After this, another issue appears, but now says "can't rename 'code.exe' file", so I used IObit again to rename the 'code.exe' to 'code.exe' (same name, I don't know why) and "Retry" again. Finally it's works! Updated succesfully.
I found what was causing it by more research, Have a look at antivirus protection software you may have and look for ransomware protection or exploit protection and temporarily disable them. As in my case, it was locking the folders to make sure viruses could not change or delete folders! All good now, hope it helps others!
wow @81mark, thanks for your advice. It actually worked for my machine !!. I tried different methods above but could not solve the issue. I turned off malware byte ransomware protection and exploit protection and it worked!
wow @81mark, thanks for your advice. It actually worked for my machine !!. I tried different methods above but could not solve the issue. I turned off malware byte ransomware protection and exploit protection and it worked!
No problem, glad it helped you out!
There was an error while Deleting a directory
"C**\***\AppData\Local\Programs\Microsoft VS Code\bin":
The process cannot access the file because it is being used by another process, (os error 32)
Please verify there are no Visual Studio Code processes still executing,
This happens to me every time I close VS Code- it starts to update, fails, and then uninstalls VS Code. I have none of the previous programs mentioned that may interfere, and am on a Windows 10 ,moreover after using Setup for vs code again for installation it is happening again.
I don't know what happened. But when I was re-installing after the code failed to install I choose install a system instead of user and that fixed the issue
[SOLVED] I had same issue, but with '\resources' folder. What I did to solve was install IObit Unlocker Software and when the error happen, I use the IObit to unlock & delete the folder and than I "Retry" the update process. After this, another issue appears, but now says "can't rename 'code.exe' file", so I used IObit again to rename the 'code.exe' to 'code.exe' (same name, I don't know why) and "Retry" again. Finally it's works! Updated succesfully.
@LuamMaul thanks bro it worked.. i just unlock bin folder using IObit unlocker.. then delete the bin folder, the last, i click the retry button on the error notifications..
First Uninstall Visual Studio, then go to https://code.visualstudio.com/docs/setup/windows and download Visual Studio via Zip archive link.
Move it and extract it in a new folder located wherever you prefer. Run VS. Since is another folder it shouldn't cause any trouble.
Ending Zoom and Microsoft Word worked for me
Turning off Malware Bytes seems to solve this error as recommended by @81mark
Had the same issue, Here is the solution.
1) go the directory where VS code is installed i.e User/ Program/VS Code
2) run the uninstall.exe
3) install vscode again
Most helpful comment
OK. I was able to repro this in @sergiusignacius's machine. Weirdly enough, it repros 100% of the time when Skype for Business is running. It doesn't repro when Skype for Business isn't running.
Any of you guys have Skype for Business?
Investigating...