Data loss - zero byte .md file in vault

  • macOS 11.2.1
  • Obs 0.11.3 (first noted in v0.11.2 however)

Bug

Over the last couple of days I have experienced total loss of a note’s data 4 times.

Symptoms

  • Working normally in a note for minutes, hours
  • Quit Obsidian
  • Later, re-open to find that the note’s contents are completely erased (only the Title remains)
  • Inspecting the file in Finder shows a 0-byte file.

There is no pattern I am aware of. This is making me increasingly nervous, as it now seems to be happening regularly. I know this bug report is lacking as far as repro steps, but I don’t know what circumstances are leading to this.

Has anyone else experienced this?

Here’s the list of community plugins I have loaded:

  • Advanced Tables
  • Find unlinked files and unresolved links
  • Hotkeys for starred files and searches
  • Note Refactor
  • Paste URL into selection
  • Recent Files
  • Show the current open note in the window title
  • Show Whitespace
  • Slated
  • Templater

Possibly related (though I don’t currently use or have this plugin installed): Empty files after Git Update · Issue #51 · denolehov/obsidian-git · GitHub

1 Like

As suggested by @Licat on Discord I am experimenting with disabling the following plugins for now:

  • Find unlinked files and unresolved links
  • Hotkeys for starred files and searches
  • Note Refactor
  • Paste URL into selection
  • Slated

Another possibly related thread (I may have triggered a reload with ⌘R): Ctrl + R deleting content randomly

First: that’s gotta be frustrating! Sorry to hear about the trouble.

Is it possible that there are any services or automations running on these files? This is an incomplete list of possible confounding factors:

  • Obsidian Sync
  • Other sync services
  • Keyboard Maestro
  • Automator
  • Hazel
  • Zapier/IFTTT/etc.
  • Shortcuts (iOS)
  • folder scripts

Also consider any other apps you might open these files with.

1 Like

This thread got me thinking: Could Obsidian (eventually) or some external tool (now) be used to monitor the Vault/vault folder for zero byte files and notify the user when/if any appears? With a good backup system, there would be no real harm made, with a such warning?

2 Likes
  • Obsidian Sync: no
  • Other sync services: technically, yes—my vault is in iCloud Drive, but I am currently only using it on my 1 Mac desktop.
  • Keyboard Maestro: no
  • Automator: no
  • Hazel: no
  • Zapier/IFTTT/etc.: no
  • Shortcuts (iOS): no
  • folder scripts: no

Right now my money is on this being some weirdness going on during workspace reloads triggered by ⌘R. I am going to keep a very close eye on it, especially after disabling most of my 3rd party plugins.

1 Like

Also possibly related:

1 Like

Good idea.

I created a Smart Folder on my Mac:

I specified a timeframe because I have a lot of empty files from clicking wikilinks, and those aren’t a problem.

2 Likes

Smart implementation!

1 Like

I came here to start a thread, but it might be related so I’m putting it here.

Latest versions of Mac OS and Obsidian.

I had the Checklist plugin enabled. I clicked on one task to mark it as complete. Dozens of tasks vanished. I then opened the file that the tasks were in. It now contains only the word ‘undefined’ on the first line. 9 bytes, not zero. This file originally had FOUR MONTHS of almost DAILY journal entries, and several long task lists. Now it is empty.

Although I would probably have to list the plugin as the chief suspect, this is completely unacceptable! I suddenly feel like I can no longer trust this app with any of my files…

1 Like

I am very saddened by what has happened to you. We try to warn our users about the danger of third party plugins and to have a backup system for your important notes.

2 Likes

I have identified the reason for this and will be filing an issue with the plugin author.

1 Like

Should we disable this plugin first?

You should do that until the plugin author updates the plugin. Meanwhile we have issued a deprecation that should automatically disable this plugin for most people in the next few hours.

1 Like

The 2 cases in discord did not have the checklist (todo|text-based gtd) enabled though? Or the other case maybe due to the Obsidian save process?

Still haven’t found conclusive evidence of what the other two are caused by. So far there hasn’t been any reports of data loss while not using any community plugins.

1 Like

Glad to hear there is progress on finding the root cause of this sad/frustrating problem. I really appreciate your efforts to track this down @Licat !

I for one did not have the Checklist plugin enabled. So for me that is not the final answer. But, do you think one of the other plugins from my list could have suffered from the same vault.read bug?

I have searched through the code of all plugins using GitHub and identified 2 more plugins doing something similar, but none of those are in your list. (They are obsidian-query-language and obsidian-text-expand)

I have filed issues on their github repos as well.

1 Like

Oh. Hmm. @Licat I actually do have Obsidian Query Language installed (but it’s deactivated). I believe it was inactive at the time of my data loss, but to be completely honest I am not 100% certain. So that may be the root cause after all. In any case, it’s certainly disabled now.

Can disabled plugins cause any problems?

1 Like

Disabled plugins shouldn’t affect the app. Obsidian Query Language is also a display-only plugin I believe, as it does not attempt to write files back to disk, so it shouldn’t be a cause for data loss.

1 Like