Atom crashed and my source file ended up blank


#1

I was writing code the other day in Atom and it started freezing and ultimately ended up with a dialog that asked me if I wanted to exit. I waited a while longer and decided to exit. I restarted Atom and boom, a major source file is now blank!

Is there a way to restore the contents? Surely there’s a built-in history tool like in IntelliJ?


Need help to recover my scripts
#2

Are you using git? If not, consider doing so.

Atom is more like Sublime Text, as in, it’s a text editor, not an IDE. However, you can install packages that will make it perform more like an IDE. For automatic backups, I see there is a package local-history. I have not tried it, but seems like what you are looking for.


#3

While Git or any external tool could have saved me, it’s not my job to ensure the source code does not disappear. It’s not like I’m going to create WIP commits once in every 30 seconds or so, just to be safe.

As a matter of fact I installed this local-history extension. I was expecting some sort of backup/history functionality to be there by default, however.

On top of this, I’d understand if there’s an unsaved buffer which gets lost, but in my case I had saved the file to the disk yet it got erased. I suspect that the save logic does a truncate before a write, and it just so happened to crash in between those two phases.

Therefore, I’d say the save process that Atom has is not atomic (no pun intended). In a well designed system, a file write would write the changes to a temporary file, which is then used to replace the actual file.

In any case, a modern text editor, as they say on the front page, should not lead to me losing my data like this. I understand Atom is not 1.0 yet, so, I suppose it was my fault, but for the sake of soundness, this issue should be resolved.


#4

Yes this just happened to me and I’m using version Atom v1.0.
No recovery, no swap file, just a 0 byte file where my original data was.
I’ve since noticed that I’m out of disk space so that’s probably the cause of it.
That said – there’s no way it should have wiped the contents of my file!


#5

The option to create temporary backup files when saving has been available since v1.0.4:

It isn’t on by default yet because we weren’t sure if it would have adverse side-effects of its own.


#6

I’m just adding my voice to Kai’s … last night my computer restarted due to a Windows Update, unbeknownst to me. The source file I was working on reverted because Atom doesn’t store a temporary copy of unsaved files. I agree with Kai that I think the metaphor of modern text editors is that they will hold onto unsaved files … Notepad++ does this seamlessly. I have git … I was just in the middle of editing something, it wasn’t ready to be checked in yet.


#7

The same thing just happened to me. It is an unacceptable bug. Just crashed and the file I was working on was totally empty. And saved. Spend ours trying to recover it, unsuccessfully. I always use git, but, lucky me, I wasn’t this time. I lost all my work. And yes, this was on the stable version. I can’t believe Atom has a bug like this.


#8

I second this… sublime always saves any unsaved windows, when the computer crashes, sublime crashes you have 100% guarantee that any files or notes you were working on are still there…

I’ve been burned by Atom at least 2-3 times now where osx forced a restart or atom crashed and I’ve lost notes I take throughout the day… I hope this gets fixed soon…

I’ve tried local-history but seems to only work with files that have been saved in the past not windows where you just start typing into without saving, for note taking purposes.


#9

We’re working on some stuff to help with crash recovery on master right now. If we can get all the kinks out of it, it should be out with v1.7.0. See the PR here:


#10

This just happened in v1.7.2. Cant believe this is happening.


#11

The same crash just happened to me while Atom was open.
I checked on something else and when I came back to work on my file, all of its contents were deleted. Nothing remained.


#12

I’m really sorry to hear that you lost work. I want to get to the bottom of this. I hope you don’t mind if I ask some questions so that we can track this down?

Was the file you were working on edited by another process? Was it on a local filesystem? Or on a network somewhere? Did the system go to sleep? Anything else you can think of that might have triggered Atom into acting? (Atom isn’t designed to just spontaneously do things, though installed packages could trigger actions periodically.)


#13

This just happened to me as well. I was trying to run a heavy Python script when my computer froze. All my files were saved before this, but when I restarted my computer, two files were blank.


#14

@phber Any chance you can answer @lee-dohm’s questions above?


#15

Well, the file I was working on wasn’t edited by another process as far as I know. But as I mentioned, I was running it with Python The file was on my local C: drive which has plenty of space, although I’m pretty sure the heavy python script I was running overloaded my memory.


#16

Were the two files open in Atom when your computer froze?


#17

Yes, the two files were open. Although I’m not why both were blank since only one was being processed by Python.I should maybe also mention that after my computer froze I get the following error when starting atom:

“Failed to load config.cson”

And also it won’t detect python.exe even though it’s in my PATH.


#18

Shit, just happened to me in a massive work file.
It was about 1m sizes file.
5 days work are lost.
PC restarted because power down. When i switched it on the last two files that i have worked on were blank.

Fuck this. Back to sublime.


#19

Hi,

I have got the same problem, it has happened in multiple occasions. On my Mac and PC
saved files got wiped clean to 0 bytes

I am running 1.7.3

My secenario is:

I saved the file, then working on the next file.

Once i have too many tabs opened (7-10)

i did Save all file by clicking the the save all under the file menu

followed by a close all tabs

when i revisit couple of files i modified earlier its all empty. Some has been saved and some haven’t

I like the Editor, but I can’t justify it when it comes to lost of work


#20

We’re taking this very seriously. Finding and fixing this is a high priority for us. We’ve been trying to reproduce this to no avail. We would like to try and replicate your environment. For that we’ll need:

  1. What OS and version of the OS you’re running
  2. Which version of Atom you have installed
  3. A list of all the packages you have installed along with their versions (you can get this easily with apm list)
  4. Your entire config.cson
  5. Your init.coffee
  6. Anything else you can think of that is relevant

We want to get to the bottom of this, so any help you can give us to replicate the problem would be sincerely appreciated!


Just lost a day of changes in several files