This is a bug report regarding the support for custom properties inside .canvas files. A file node with a custom property of type object or list will cause a corrupted canvas file due to a trailing comma in the resulting JSON. If you try to open it again, the error <Failed to open “”>
As stated above, the save file will contain a trailing comma, corrupting the whole file.
Environment
SYSTEM INFO:
Obsidian version: v1.6.5
Installer version: v1.5.3
Operating system: Windows 10 Pro 10.0.22631
Login status: not logged in
Insider build toggle: off
Live preview: on
Base theme: adapt to system
Community theme: none
Snippets enabled: 0
Restricted mode: off
Plugins installed: 4
Plugins enabled: 0
RECOMMENDATIONS:
none
Additional information
I really think this is a critical bug. Proper support for custom properties is crucial to enable third-party plugins to improve the canvas experience.
I have suggested to Mike on Discord to add simple reproduction steps on this, and would suggest attaching the simplest possible .canvas file that contains the problem.
Yes, thank you ClareMacrae for your suggestions for improvement.
Steps To Reproduce
Create a new canvas and add a file node
Open the canvas file inside a text editor
Add a custom property with a value type of object ({}) or list ([]) inside the file node data object (In the following example, I’ve added the field customProperty)
Open the file inside Obsidian
Modify the file and save it
Try to reopen the file inside Obsidian → The following error notice shows up
Error Popup
Reason Of The Error
The canvas core plugin uses a custom JSON stringify function. This function is the culprit of this behavior. If a file node contains a property that is of type object or list, it adds a trailing comma to the last key-value pair of the file node data. This causes a read error when reopening it.
Example File
(No .canvas file upload is allowed, so I just share a zip here) Saving Error.zip (495 Bytes)
Importance
While this issue doesn’t affect the core canvas plugin (yet), the support for custom properties is crucial for any canvas-enhancing plugin. Additionally, a broken JSON stringify function is a ticking time bomb that must be fixed sooner or later (I wish sooner ).
This needs to be fixed very very soon, I’ve already lost a lot of progress on some canvases due to this bug. Honestly they need to add more features and updates to canvas in general, it’s very limited with what you can do with it, we wouldn’t have to deal with this bug in the first place if canvas received more updates. Heptabase has so much quality of life features with their canvas I’m surprised Obsidian hasn’t caught up in the slightest.