Investigating "Got metadata for path but could not fetch content"

Operating system

macOS

Joplin version

3.2.13

Desktop version info

Joplin 3.2.13 (prod, darwin)

Client ID: fba6c7f92ec0447c8f5948b0a057f3e9
Sync Version: 3
Profile Version: 47
Keychain Supported: Yes

Revision: a898e17

Backup: 1.4.2
Freehand Drawing: 2.16.0

Sync target

File system

What issue do you have?

I know that there are similar posts out there, but 1) they didn't help me resolve my problem and 2) I'm providing additional information here that may help others who are investigating this.
This is 1 of 2 posts, I can't crosslink the other one due to forum limitations but you can find it on my profile. It's called : Investigating “Some items cannot be synchronised.”

---- Important context info ----

  • I selected macOS above because that's where I'm writing from, but I also had a copy installed on a Windows 10 machine (3.2.13, just uninstalled it trying to fix this issue)
  • I selected Sync target = File system because I do point Joplin to a folder on the computer - although it's a cloud folder that belongs to the app Sync, which is similar to Dropbox et al.
  • I have backups of the files from both systems before I tried to fix this issue with no luck.

---- On to the investigation ---
As you can see from the screenshot, this specific error refers to file 7d7d263ef1f641fea7bf92b3a1c3ddf1.md (but I assume there are many more). From here on I'll refer to it just as "7d" to save space.

  • Searching for this file in the cloud folder on the file system gave me 2 results :
    -- File A : "7d". It has no information whatsoever - opening it with notepad shows a blank page, and the file explorer itself says "zero bytes".
    -- File B : a2dd93928ba743ba8cd364b68c26986d.md, hereafter called "a2". Opening it with Textedit shows content.

--- First 4 lines in text file for "a2":
id: a2dd93928ba743ba8cd364b68c26986d
parent_id:
item_type: 1
item_id: 7d7d263ef1f641fea7bf92b3a1c3ddf1

--- Relevant content in the metadata at the end of "a2":
metadata_diff: {"new":{"id":"7d7d263ef1f641fea7bf92b3a1c3ddf1",

  • Searching for "7d" in the internal Joplin search found a Joplin note. Don't know if it's relevant, but it's text only, no images or other attachments. It has the same content as what can be seen when opening "a2" in Textedit.

  • Searching for "a2" in the internal Joplin search didn't find anything.

  • Searching for "7d" in database.sqlite in the home folder on the machine found 54 matches.

  • Searching for "a2" in the same file found 20 matches.

So, summarizing :

  1. Error message says "Got metadata for path but could not fetch content:"7d"
  2. "7d" can be found in Joplin by searching for note ID, which has content
  3. "7d" can be found in the file system but it's empty
  4. "a2" cannot be found in Joplin by searching for note ID
  5. "a2" can be found in the file system - and it has the same content as "7d" in Joplin
  6. In the metadata at the top of the file, "a2" says its id is "a2", but then says its item_id is "7d"
  7. In the metadata at the end of the file, "a2" says its id is "7d"
  8. Multiple references to both files in the database.sqlite file.

My guess would be that Joplin finds "7d" in the file system ("got metadata for path") but then sees it's empty ("could not fetch content"). The real file is actually "a2", which for some reason also says it's "7d" (I'm not clear on the differences between id at the top of the file, id at the bottom of the file, and item_id). So the note in Joplin reads the content off "a2", but because there's also an empty "7d" file it flags that issue. Seems like it generated another ghost file and then got references crossed, but at this point I'm just making up theories so I hope someone with more definite info chimes in with:

  1. An explanation
  2. A solution that can be applied across multiple files

Thanks!
Stilt

Screenshots