0-byte file (again) - note completely destroyed

I’ve been working on a debug logging plugin as per Licat’s suggestion far above in the thread. It monkey patches vault.modify and binds to other events like delete, rename etc as well. I’m just polishing it up and expect to release it this week. I hope it helps me and others as well towards tracking down this extremely elusive bug.


If you write on a note and immediately close obsidian, we are aware that a file loss might occur.


If it happens in other circumstances, let us know.

Same bug here in win10 OS. Obsidian is totally local run, without using Sync & Publish core plugins. I’ve met it several weeks before for the same file that is edited most frequently.

Obsidian: v1.1.9

Activated Community Plugins:

  • Advanced Tables 0.18.1
  • Calendar 1.5.10
  • Dataview 0.5.47
  • Dictionary 2.22.0
  • Full Calendar 0.9.1
  • Kanban 1.5.1
  • Projects 1.11.5
  • Zotero Integration 2.2.34

The 0-byte file only appears if you close Obsidian within 1 second of editing the file.
→ So until the bug is fixed, the workaround is to wait 2 seconds after the last edit before closing Obsidian.

1 Like

Shouldn’t Obsidian be smart enough to not close before writing unsaved data to disk? (If not, I assume it would be fairly straightforward to change its code such that it delays quitting until that has been done.)


I’ve experienced this 0-byte data loss a few times in the last week, in conjunction with this sudden black screen bug: Sudden Black screen in one obsidian vault

In all cases, the 0-byte file occurred when I was typing, got the black screen, and rapidly exited Obsidian (within 1-2 sec).

When I wait several seconds to exit after the black screen, I’ve never gotten data loss.

OP @luckman212 - when you have gotten 0-byte files, were you closing the files or exiting obsidian immediately after editing text?

@Sentiment Hard to say for sure, but yes pretty sure this bug relates to “quitting Obsidian too fast” after editing text, which sounds ridiculous but apparently is a thing. I’ve been running with my test debug logging plugin for a few weeks now (sorry I haven’t released it yet, I was trying to polish a few things and then I got sidetracked by another project- I hope to have it posted very soon).

One of the features it has (optional of course) is a popup notice to alert when Obsidian is saving. This little visual cue has trained me to wait until that message goes away before quitting. It’s a small thing, but I haven’t had this data loss since I started paying attention to that.

I’m still at a loss as to why making sure the file is written to disk before the app quits is such a problematic thing to debug, but I’m sure it has something to do with Obsidian being an Electron app.


If this bug is the same, I’ll merge this thread with the other.

This also happen another day with me. I’m glad that I could recovery my file using the “File Recovery”

For a second my heart stopped, I thought I lost days of work

I’m currently using One drive to store my vault.

@TESLA Did this incident follow the same pattern we’re identifying here, ie you exited obsidian within 1-2 seconds of your last edit to the file, and next time you opened the file was zeroed out?

Unfortunately i don’t remember if I did this when I close Obsidian

1 Like

Can’t say w 100% certainty, but lion’s share of the evidence suggests it is the same bug.

1 Like

Just for documentation, it seems I experienced this 0-byte blank file issue while running version 1.1.16 on Windows 7 without any syncing or publish features on, and the vault is on the same physical hard drive of the Windows installation and Obsidian.

Since there is no evidence that this is a different problem than https://forum.obsidian.md/t/file-content-sometimes-gets-lost-if-obsidian-is-closed-right-after-editing/47053. Please continue the discussion here

If the note is wiped out in any other circumstance, please open a new bug report, follow the template, and provide as much info to reproduce the problem as possible.