Sublime Forum

Unable to save - Sublime Text 3

#1

Hello,

I have a constant issue where I go to save a file and I get an error that pops up with:

Unable to save [the file path] Error: The process cannot access the file because it is being used by another process.

I have tried resaving, opening a different file and going back and saving, turning off atomic_save in my settings and many more things. I usually just copy the whole content of the file, close SublimeText 3, reopen the program paste the content back in and then I can save it. This happens about every other time I save a file and itā€™s become unbearable. Itā€™s been happening for quite some time now, but was not there when I first installed the program. There shouldnā€™t be anything else using the files on my machine.

Here is the important info:
ā€¢ Windows 7 64bit
ā€¢ SublimeText 3
ā€¢ I have disabled file backups and virus protection (just as a test, but it didnā€™t change anything)
ā€¢ These are the packages I have installed: Alignment, Emmet, Emmet LiveStyle, Package Control, Side Bar, SFTP, SublimeLinter

Has anyone experienced this, or have any thoughts? Thank you!

0 Likes

#2

Iā€™ve been having the same problem for a day or so now.

I have Sublime Text 3 on my PC at home, and it has been working fine there (though I havenā€™t used it for some time at home now). At work I had Sublime Text 2 on my PC, and yesterday decided to install ST 3. Thatā€™s when I started getting this same error. I restarted the PC and it seemed to be working fine for the rest of the afternoon, but itā€™s back at it again this morning.

ā€” edit ā€”

OS: Windows 7 64-bit
ST Build: 3059

I have Package Controller and HTML Snippets, I think thatā€™s it.

0 Likes

#3

Windows has a very lock-happy filesystem. Unfortunately some programs will lock and file an not let go. This happens sometimes in Windows Explorer. Youā€™ll go to a folder and look at some files and they try to delete the folder. Windows wonā€™t let you because it says the file is in use. In those situations, you usually have to close explorer.exe and re-launch it to delete the file.

From my experience, the (naive) way to figure out what is locking the file is to close other programs one at a time. If all of your other programs are closed, start stopping services. Such as your antivirus, Windows Search Indexer, etc. Sometimes it is even explorer.exe. You could also try ending the Sublime Text indexer executable to see if that is locking the file. The way it is written right now it should bail on a file if it is having trouble, but I do know of one person who ran into issues with something on their machine locking up the Sublime Text indexer.

There may be a better way to figure out what is locking the file, however I donā€™t know off of the top of my head.

1 Like

#4

[quote=ā€œeMarvinā€]

[quote=ā€œswthateā€]Iā€™ve been having the same problem for a day or so now.

ā€¦]

I have Package Controller and HTML Snippets, I think thatā€™s it.[/quote]

Iā€™ve seen this too, and I donā€™t have any plugins installed on the windows machine.

Probably a bug in the atomic save thing, because it works without it.[/quote]

I donā€™t think this problem is strictly related with atomic save, I can reproduce the error (from time to time) even with atomic save set to false if i hit ctrl+s several times in a row.
Itā€™s more like the os canā€™t unlock the file as fast as the keyboard commands are sentā€¦ (of course it could be also STā€™s bug or even a combination of st and win that trigger the problem)

0 Likes

#5

This seems to be the case as, like I wrote just above you can reproduce the problem even with no atomic-saveā€¦
Anyway, whatā€™s the advantage to repeatedly hitting ctrl+s? I mean, after first hit the file is savedā€¦ thereā€™s no real need to do it again and again in rapid successionā€¦ or at least no needs that Iā€™m aware ofā€¦

0 Likes

#6

[quote=ā€œOrlmenteā€]

This seems to be the case as, like I wrote just above you can reproduce the problem even with no atomic-saveā€¦
Anyway, whatā€™s the advantage to repeatedly hitting ctrl+s? I mean, after first hit the file is savedā€¦ thereā€™s no real need to do it again and again in rapid successionā€¦ or at least no needs that Iā€™m aware ofā€¦[/quote]

I have the same problem. The point of quickly doing ctrl+s is just to show the bug in an easy way, at least for me. The error comes even without doing this, but less frequently. Also, I sometimes press the ā€˜sā€™ too long, so I accidentally get this message.

Because of this bug, I have lost files, because the error occured when leaving sublime during a reboot

0 Likes

#7

Thanks for your post. In case anyone else has the same problem:

I closed a bunch of programs and it was still locked. But I still had Windows Explorer open to the folder my locked file resided. When I refreshed (F5) and closed it, I was able to save my file again.

0 Likes

#8

I donā€™t think iā€™ve ever had this problem. The only thing i can think of that may be different is i always set sublime.exe to run as administrator.

0 Likes

#9

Doesnā€™t help sadly.

0 Likes

#10

Just wanted to add that running Sublime Text 3 as administrator on Windows Server 2016 Standard ā€œseemsā€ to have fixed my issue with this. However, it also ā€œseemedā€ to help to not have Windows Explorer open when I wasnā€™t running Sublime Text 3 as administrator.

UPDATE 1: The issue started happening again, AND I have removed as many packages as possible. I am down to those packages that I truly need for my current work. Will update if I find a solution.

UPDATE 2: I installed another popular editor to see if the problem might not be related to Sublime, and regrettably for the case of Sublime, this issue is not happening in that editor (Atom). Iā€™ll try to keep using Sublime in Linux Mint to see if the issue happens there. I think that this may only be a windows issue. I am not yet sure if itā€™s both Windows 10 and Windows Server 2016, but I believe that it is.

0 Likes

#11

Iā€™m having the same issue here with Windows 10, It just occurred out of a sudden, I use Sublime on daily basis. I restarted my Laptop and the problem seemed solved until It came back again after 5min of coding.
I m still facing the same problem, If anyone can helpā€¦

0 Likes