obsidian-dataview icon indicating copy to clipboard operation
obsidian-dataview copied to clipboard

Bug report: Dataview says file has no Obsidian metadata, but it does

Open RyotaUshio opened this issue 2 years ago • 6 comments
trafficstars

What happened?

An error saying "Cannot index file, since it has no Obsidian file metadata." is thrown, but the metadata does exist.

https://github.com/blacksmithgu/obsidian-dataview/assets/72342591/162a4957-1c93-42f0-8e9e-d3e5cc3e018d

This error keeps being thrown even when there's no active MarkdownView, so I assume it has nothing to do with a particular query.

DQL

No response

JS

No response

Dataview Version

0.5.58

Obsidian Version

1.4.13

OS

MacOS

RyotaUshio avatar Sep 16 '23 18:09 RyotaUshio

Can you share the file and steps to reproduce the issue?

AB1908 avatar Sep 18 '23 03:09 AB1908

I am seeing this issue continuously, and haven't found a way to avoid it yet. I do have some potential steps to reproduce the issue though.

I am developing an Obsidian plugin, and set up a process for logging debug output into a file. The log output looks like this, where the three dashes separate each individual log (perhaps this is confusing DataView since it looks like front matter? I tried messing with the top of the file so that it starts with valid front matter, but that did not help):

---

local_save

---

[
  "Successful report:",
  ""
]

---

[
  "Successful report:",
  ""
]

---

[
  "INFO ** destroying_extension",
  {
    "id": "some-uuid"
  }
]

Etc, etc.

I am using a standard Obsidian function call to append each change to the file:

await this.app.vault.append(this.debugFile, '\n\n---\n\n' + stringifiedData);

I'm not sure if it triggers explicitly when appending multiple times in a row or if it's after every append, because my use case always tends to trigger batches of appends. But, essentially every single time a batch of appends goes through, I see this DataView error bubble up in the console:

Error: Cannot index file, since it has no Obsidian file metadata.
    at failableImport (9fc9d35e-681d-420c-a788-a5aa9e061fda:9427:17)
    at onmessage (9fc9d35e-681d-420c-a788-a5aa9e061fda:9434:24)

The file itself was programmatically created, but again that happens via a standard Obsidian function call:

await this.app.vault.create('debugFileName', '');

Not sure if any of that helps y'all narrow down the issue here, but it would be awesome to see this fixed, as it makes debugging other plugins really difficult when the console is constantly cluttered with DataView errors.

I'm also happy to try anything if you have an idea on how I could avoid the issue by changing something with my own setup.

Thanks!

ajguyot avatar Feb 19 '24 20:02 ajguyot

Can you use this file in a sandbox vault and test if it still has this issue, share this vault with us?

AB1908 avatar Mar 02 '24 06:03 AB1908

I get this a lot when using the Logstravaganza plugin:


| Timestamp | Originator | Level | Message |
| --------- | ---------- | ----- | ------- |
| 2024-06-24T05:16:04.974Z | sender:unknown | fatal | Uncaught (in promise) Failed to index file: ZZ Logs/Logstravaganza logs/console-log.Clares-MacBook-Pro.local.2024-06-24.md: Error: Cannot index file, since it has no Obsidian file metadata. |
| 2024-06-24T05:19:05.429Z | sender:unknown | fatal | Uncaught (in promise) Failed to index file: ZZ Logs/Logstravaganza logs/console-log.Clares-MacBook-Pro.local.2024-06-24.md: Error: Cannot index file, since it has no Obsidian file metadata. |
| 2024-06-24T05:19:34.529Z | sender:unknown | fatal | Uncaught (in promise) Failed to index file: ZZ Logs/Logstravaganza logs/console-log.Clares-MacBook-Pro.local.2024-06-24.md: Error: Cannot index file, since it has no Obsidian file metadata. |
| 2024-06-24T05:21:52.347Z | sender:unknown | fatal | Uncaught (in promise) Failed to index file: ZZ Logs/Logstravaganza logs/console-log.Clares-MacBook-Pro.local.2024-06-24.md: Error: Cannot index file, since it has no Obsidian file metadata. |
| 2024-06-24T05:23:18.287Z | sender:unknown | fatal | Uncaught (in promise) Failed to index file: ZZ Logs/Logstravaganza logs/console-log.Clares-MacBook-Pro.local.2024-06-24.md: Error: Cannot index file, since it has no Obsidian file metadata. |
| 2024-06-24T05:24:41.751Z | sender:unknown | fatal | Uncaught (in promise) Failed to index file: ZZ Logs/Logstravaganza logs/console-log.Clares-MacBook-Pro.local.2024-06-24.md: Error: Cannot index file, since it has no Obsidian file metadata. |
| 2024-06-24T05:24:52.486Z | sender:unknown | fatal | Uncaught (in promise) Failed to index file: ZZ Logs/Logstravaganza logs/console-log.Clares-MacBook-Pro.local.2024-06-24.md: Error: Cannot index file, since it has no Obsidian file metadata. |
| 2024-06-24T05:24:52.745Z | sender:unknown | fatal | Uncaught (in promise) Failed to index file: ZZ Logs/Logstravaganza logs/console-log.Clares-MacBook-Pro.local.2024-06-24.md: Error: Cannot index file, since it has no Obsidian file metadata. |
| 2024-06-24T05:24:52.981Z | sender:unknown | fatal | Uncaught (in promise) Failed to index file: ZZ Logs/Logstravaganza logs/console-log.Clares-MacBook-Pro.local.2024-06-24.md: Error: Cannot index file, since it has no Obsidian file metadata. |
| 2024-06-24T05:24:53.264Z | sender:unknown | fatal | Uncaught (in promise) Failed to index file: ZZ Logs/Logstravaganza logs/console-log.Clares-MacBook-Pro.local.2024-06-24.md: Error: Cannot index file, since it has no Obsidian file metadata. |
| 2024-06-24T05:26:07.918Z | sender:unknown | fatal | Uncaught (in promise) Failed to index file: ZZ Logs/Logstravaganza logs/console-log.Clares-MacBook-Pro.local.2024-06-24.md: Error: Cannot index file, since it has no Obsidian file metadata. |
| 2024-06-24T05:26:40.450Z | sender:unknown | fatal | Uncaught (in promise) Failed to index file: ZZ Logs/Logstravaganza logs/console-log.Clares-MacBook-Pro.local.2024-06-24.md: Error: Cannot index file, since it has no Obsidian file metadata. |
| 2024-06-24T05:27:34.424Z | sender:unknown | fatal | Uncaught (in promise) Failed to index file: ZZ Logs/Logstravaganza logs/console-log.Clares-MacBook-Pro.local.2024-06-24.md: Error: Cannot index file, since it has no Obsidian file metadata. |
| 2024-06-24T05:27:36.094Z | sender:unknown | fatal | Uncaught (in promise) Failed to index file: ZZ Logs/Logstravaganza logs/console-log.Clares-MacBook-Pro.local.2024-06-24.md: Error: Cannot index file, since it has no Obsidian file metadata. |
| 2024-06-24T05:27:37.541Z | sender:unknown | fatal | Uncaught (in promise) Failed to index file: ZZ Logs/Logstravaganza logs/console-log.Clares-MacBook-Pro.local.2024-06-24.md: Error: Cannot index file, since it has no Obsidian file metadata. |
| 2024-06-24T05:27:38.433Z | sender:unknown | fatal | Uncaught (in promise) Failed to index file: ZZ Logs/Logstravaganza logs/console-log.Clares-MacBook-Pro.local.2024-06-24.md: Error: Cannot index file, since it has no Obsidian file metadata. |
| 2024-06-24T05:27:39.343Z | sender:unknown | fatal | Uncaught (in promise) Failed to index file: ZZ Logs/Logstravaganza logs/console-log.Clares-MacBook-Pro.local.2024-06-24.md: Error: Cannot index file, since it has no Obsidian file metadata. |
| 2024-06-24T05:27:39.844Z | sender:unknown | fatal | Uncaught (in promise) Failed to index file: ZZ Logs/Logstravaganza logs/console-log.Clares-MacBook-Pro.local.2024-06-24.md: Error: Cannot index file, since it has no Obsidian file metadata. |
| 2024-06-24T05:27:40.471Z | sender:unknown | fatal | Uncaught (in promise) Failed to index file: ZZ Logs/Logstravaganza logs/console-log.Clares-MacBook-Pro.local.2024-06-24.md: Error: Cannot index file, since it has no Obsidian file metadata. |
| 2024-06-24T05:27:42.120Z | sender:unknown | fatal | Uncaught (in promise) Failed to index file: ZZ Logs/Logstravaganza logs/console-log.Clares-MacBook-Pro.local.2024-06-24.md: Error: Cannot index file, since it has no Obsidian file metadata. |
| 2024-06-24T05:27:42.648Z | sender:unknown | fatal | Uncaught (in promise) Failed to index file: ZZ Logs/Logstravaganza logs/console-log.Clares-MacBook-Pro.local.2024-06-24.md: Error: Cannot index file, since it has no Obsidian file metadata. |

claremacrae avatar Jun 24 '24 06:06 claremacrae

The source code location is line 9 here:

https://github.com/blacksmithgu/obsidian-dataview/blob/15b8d527e3d5822c5ef9bfd23f528a64769d545b/src/data-import/web-worker/import-entry.ts#L6-L13

claremacrae avatar Jun 24 '24 14:06 claremacrae

The source code location is line 9 here:

https://github.com/blacksmithgu/obsidian-dataview/blob/15b8d527e3d5822c5ef9bfd23f528a64769d545b/src/data-import/web-worker/import-entry.ts#L6-L13

And it's called in the same file...

What I don't understand is how to find that code in the released plugin.

It's web-worker code, and I cannot find the strings Cannot index file and Failed to index file in the released plugin.

All I want to do is comment the code out in the released dataview, to avoid my version-controlled copies of the logs having lots of "Cannot index file, since it has no Obsidian file metadata." lines...

claremacrae avatar Jun 24 '24 16:06 claremacrae