File content was replaced with null characters and the latest version from File Recovery with original content and nulls after the content can't be copied

Steps to reproduce

  1. Open Obsidian
  2. Open corrupted file from left panel with files list or click a link to the file in another file
  3. Obsidian shows a note with null characters only + it starts to freeze and can’t be closed for some time

Expected result

I open any note and it’s content is fully present without any corruption

Actual result

Obsidian is freezing. The file is destroyed and the latest version from File Recovery can’t be recovered because the note’s content from File Recovery isn’t available from clipboard and can’t be copied manually since it’s not possible to copy it with mouse or keyboard shortcuts.

Environment

SYSTEM INFO:
Obsidian version: v0.15.9
Installer version: v0.15.6
Operating system: Windows 10 Home Single Language 10.0.19044
Login status: not logged in
Insider build toggle: off
Live preview: on
Legacy editor: off
Base theme: dark
Community theme: none
Snippets enabled: 3
Restricted mode: off
Plugins installed: 71
Plugins enabled: 36
1: Advanced Mobile Toolbar v1.7.7
2: Banners v1.3.3
3: Better File Link v1.1.2
4: Calendar v1.5.10
5: Customizable Page Header and Title Bar v4.6.2
6: Customizable Sidebar v2.2.1
7: Cycle through Panes v0.1.0
8: Emoji Toolbar v0.3.1
9: Find orphaned files and broken links v1.6.0
10: Grandfather v1.0.1
11: Map View v2.1.1
12: Mousewheel Image zoom v1.0.13
13: Natural Language Dates v0.6.1
14: Paste URL into selection v1.7.0
15: Periodic Notes v0.0.17
16: Privacy Glasses v0.5.2
17: Prompt v1.0.2
18: TimeStamper v1.2.0
19: Templater v1.12.0
20: Review v1.6.4
21: Reading Time v1.1.1
22: Random Structural Diary v1.1.2
23: Frontmatter Tag Suggest v0.4.1
24: Paste image rename v1.5.0
25: Better Word Count v0.8.1
26: Hotkey Helper v0.3.11
27: Auto Link Title v1.2.5
28: Obsidian Tabs v1.0.7
29: Homepage v2.2.1
30: Sidebar Expand on Hover v1.0.1
31: ePub Reader v1.0.1
32: Remember cursor position v1.0.7
33: Omnisearch v1.5.2
34: Smart Random Note v0.2.1
35: Full Calendar v0.6.1
36: PodNotes v1.10.2


Additional information

I saw previous already closed bug reports with the same issue. One of triggers caused the bug was an unexpected computer shutdown. Maybe the problem in my case is the same: my laptop has an issue with a correct displaying of remaning battery power so it’s just turned off at some point yesterday. But I have to add an important remark: the version of the corrupted file before the latest one was shot after the shutdown and it was ok. The latest version of the file was shot 14 hours later, today, and it contains the note + many nulls after (UPD the latest version of the file contains the file content itself but it has red background while the green empty area possibly containing invisible null characters goes after). The file itself consists only of 11338 null characters now.

Sorry for this bad incident. Just for information: if you had synced your vault with Obsidian sync — it seems not to be the case — would it have changed something to the issue you describe here? Would you be able to retrieve your initial vault? (I’m trying to understand the way things work).

1 Like

That won’t solve the original issue, but you could try to use the community diff plugin and see whether it lets you recover the data. (If I understood correctly, that the old file version is still available but just cannot be restored.)
Disclaimer: I am the author.
Link to plugin

1 Like

By the way, I’ve just found I have many files that were zeroed (UPD I mean cleaned, got the weight of 0 bytes, not filled with zero characters in this case) completely during last few days. The latest case was 4 minutes ago, I opened Obsidian and found empty files, without null characters in this case but File Recovery says it has happened few minutes ago. It shows the content on a red background and a large empty area with green background: just like in the case with zero characters, in File Recovery you can’t see these characters, only empty area.
I don’t know what’s happening right now with my data

Now I’ve found 1 more interesting case: I see files in File Recovery that were cleared at some point and than recovered few minutes later without my actions. Huge amount of such files. It has happened on the 4th of August. Maybe it’s connected to the latest update somehow

I don’t use any cloud solutions for now, only local folder

I think latest versions contain only thousands of null characters that can’t be even copied because of a buffer max size or something else + Obsidian freezes when I open such files. I thought latest version have the original content inside but it’s on the red background so it means it was removed and zero characters were added (green background)

@max_samusevich Does it happen when you disable your plugins? You have 36 (!) plugins enabled, there is a possibility that one of the plugins is causing weird behavior. (Anyway, your bug report is likely to be closed by one of the mods if you haven’t tried this, as the template for bug reports states explicitly that they won’t be accepted with community plugins enabled…).

I’ve just manually opened thousands of notes, some of them were empty, some of them look ok, but File Recovery notices that many of these files were completely empty and than recovered without my actions right when I was opening them.

I’ll try to enable Safe Mode and look if something will change. I opened this bug report because I see that the same has already happened few times with other people and one of reasons could be the shutdown of a computer + I’m watching how months of my work are being destroyed occasionally. Of course, I’m trying to find a solution for myself and other users.

Never, never ever use obsidian (like any other digital app) without any local backup solution! :point_up:

When there is a computer crash, it can happen that the files that you are currently working on gets corrupted.

This doesn’t seems your case.

Have a backup. Are there any errors in console when this behavior happens? ctrl-shift-i.

I believe i have the same issue. Here is my copied console issues.

[Violation] ‘requestAnimationFrame’ handler took 179ms
app.js:1 [Violation] ‘requestAnimationFrame’ handler took 356ms
[Violation] ‘scroll’ handler took 1716ms
5[Violation] Forced reflow while executing JavaScript took ms
[Violation] Forced reflow while executing JavaScript took 396ms
[Violation] Forced reflow while executing JavaScript took 2742ms
[Violation] Forced reflow while executing JavaScript took 2011ms
[Violation] Forced reflow while executing JavaScript took 348ms
[Violation] Forced reflow while executing JavaScript took 3182ms
[Violation] ‘scroll’ handler took 11244ms
app.js:1 [Violation] ‘contextmenu’ handler took 5914ms
app.js:1 [Violation] ‘contextmenu’ handler took 293ms
app.js:1 [Violation] ‘contextmenu’ handler took 281ms
app.js:1 [Violation] ‘keydown’ handler took 379ms
app.js:1 [Violation] ‘focus’ handler took 372ms
app.js:1 [Violation] ‘mousedown’ handler took 9140ms
[Violation] ‘mousemove’ handler took 288ms

Additionally here is my copied info of the issues tab:

  1. Audit usage of navigator.userAgent, navigator.appVersion, and navigator.platform
  2. A page or script is accessing at least one of navigator.userAgent, navigator.appVersion, and navigator.platform. Starting in Chrome 101, the amount of information available in the User Agent string will be reduced.

To fix this issue, replace the usage of navigator.userAgent, navigator.appVersion, and navigator.platform with feature detection, progressive enhancement, or migrate to navigator.userAgentData.

Note that for performance reasons, only the first access to one of the properties is shown.

  1. AFFECTED RESOURCES
1. 1 source

  1. codemirror.js:1
    • Learn more: User-Agent String Reduction

the same thing happened to me if it’s a plugin it’s very likely to be emoji shortcodes another thing I recommend is that you use google drive which is the simple and free solution to backup obsidian and if it becomes your pc it fixes the errors they make turn off quickly. don’t kill yourself bro.