0-byte file (again) - note completely destroyed

Had another note destroyed just a minute ago. So frustrating that we made it all the way to 1.0 with this still happening regularly.

Obsidian Version 1.0.2 (Installer 1.0.0)

I experienced this bug multiple times, but there are multiple weeks between when it happens.

  • It only occurs when I close/open the Obsidian vault (or somewhere between when I close and open the vault). The file content was intact when I closed the vault and when I open it again I’m greeted with an empty file.
  • Only occurred to the note that was displayed when the vault was closed. This means that it was easy for me to notice the data loss.
  • The vault is stored locally on my computers disk.
  • The OS timestamp of the file suggests that the file was not modified when I opened the vault. The vault was opened December 31, 2022 1:10 PM as shown in the File Recovery diff, but the OS modified date was December 29, which is the date where I last modified the file.
  • The vault is stored in a folder which is monitored by Syncthing. But all edits was made on the same computer and in the timeframe where the bug occurred, no other computer that shared the vault folder was turned on.

Fortunately I have been able to recover the notes using File Recovery in all the cases.

It seems like the bug is not OS dependent as it occurs on both Mac and Windows. Here is another thread with a Windows user experiencing what seems like the same bug: Complete data loss on last active note when opening vault this morning

Let me know if there is anything more I can do to help resolve the bug.

SYSTEM INFO:
Obsidian version: v1.1.9
Installer version: v0.15.9
Operating system: Windows 10 Pro 10.0.19044
Login status: not logged in
Insider build toggle: off
Live preview: on
Legacy editor: off
Base theme: adapt to system
Community theme: none
Snippets enabled: 3
Restricted mode: off
Plugins installed: 2
Plugins enabled: 2
1: Code block from selection v1.0.7
2: Quick Switcher++ v1.0.8



I checked my backup software which have a version history and can see that the file was wiped on December 29. This means that the bug probably occurred when I closed the vault and not when I opened it.

Just had a fresh 0-byte file incident. :rage:

Simply launched Obsidian, added a few lines of text and pasted in an image, then quit. All within a span of around 4 minutes. File destroyed.

macOS 13.1 + Obsidian 1.1.12 (Installer 1.1.9)

I make a backup (FreeFileSync) with the setting not to backup files with a size of 0 (to not accidently overwrite some precious notes with nothing), because I had the same experience (many times). I guess, the file content is lost by closing obsidian when files are tabbed.

One time I was the problem, so I switched the warning by deleting a file on again.

The problem seems to have something to do with quantenphysics: If you look at it, everything seems fine …:smiley:

A few days ago I had some images horizontally cut (but not completely deleted).

I wonder if I should make a tool that automatically makes a backup history of at least the .md files.

Oh, and I lost files in the plugin directory, too.

BTW: Obsidian hates it (similar to open Excel files), when it runs the vault from an external USB drive which now and then loses its connection - understandably.

The problem is, to get aware of this.

Latest Obsidian, latest Windows 10.

1 Like

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.

2 Likes

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

https://forum.obsidian.md/t/file-content-sometimes-gets-lost-if-obsidian-is-closed-right-after-editing/47053

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.)

3 Likes

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.

2 Likes

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.