obsidian-tasks-group / obsidian-tasks

Task management for the Obsidian knowledge base.
https://publish.obsidian.md/tasks/
MIT License
2.48k stars 230 forks source link

Messages at startup "There was an error reading one of the tasks in this vault." #1832

Open claremacrae opened 1 year ago

claremacrae commented 1 year ago

Please check that this issue hasn't been reported before.

Expected Behavior

That Tasks should read all the tasks in my vault without error.

(Am logging this to track my investigation)

Current behaviour

With Tasks 3.0.0, I have received a series of popup error messages at startup, with content also displayed in the content:

image

Text of one error message:

plugin:obsidian-tasks-plugin:175 There was an error reading one of the tasks in this vault.
The following task has been ignored, to prevent Tasks queries getting stuck with 'Loading Tasks ...'
Error: TypeError: Cannot destructure property 'taskSerializer' of 'za(...)' as it is undefined.
File: ACME.md
Line number: 5
Task line: - [x] #task Take out the trash 🔁 every week on Monday 📅 2021-11-15 ✅ 2021-11-15

Please create a bug report for this message at
https://github.com/obsidian-tasks-group/obsidian-tasks/issues/new/choose
to help us find and fix the underlying issue.

Include:
- either a screenshot of the error popup, or copy the text from the console, if on a desktop machine.
- the output from running the Obsidian command 'Show debug info'

The error popup will only be shown when Tasks is starting up, but if the error persists,
it will be shown in the console every time this file is edited during the Obsidian
session.

Steps to reproduce

Unsure whether it was a one-off.

Which Operating Systems are you using?

Obsidian Version

1.2.1 insider

Tasks Plugin Version

3.0.0

Checks

Possible solution

No response

claremacrae commented 1 year ago

This is a problem, as the plugin ends up finding no tasks:

image

kedestin commented 1 year ago

This may be related to testing done on #1824 .

The Settings object has no runtime input validation, to make sure that the Settings read from disk actually matches the type described in Settings.ts.

Based on the error message, it looks like it's failing here:

https://github.com/obsidian-tasks-group/obsidian-tasks/blob/d5ae196564067bb00b53e17e7e41b626e38d21c4/src/Task.ts#L235

since the function call is returning undefined

https://github.com/obsidian-tasks-group/obsidian-tasks/blob/d5ae196564067bb00b53e17e7e41b626e38d21c4/src/Config/Settings.ts#L185-L193

My guess would be that if you look at your data.json, taskFormat will be one of taskFormatPlaintext or dataview which are currently only valid in the scope of #1824 . If this conjecture is true, then I wouldn't expect this to be an issue that many people are seeing.