PKM-er / obsidian-zotlit

A third-party project that aims to facilitate the integration between Obsidian.md and Zotero, by providing a set of community plugins for both Obsidian and Zotero.
https://zotlit.aidenlx.top
MIT License
647 stars 29 forks source link

Bug: Deleting all annotations in Zotero breaks the literature note in Obsidian #290

Open DennisFriedl opened 8 months ago

DennisFriedl commented 8 months ago

Steps to reproduce:

  1. Annotate a PDF in Zotero
  2. Create a literature note from that PDF in Obsidian
  3. Delete all annotations in Zotero
  4. Add other annotations in Zotero after deleting the old ones
  5. Click "Update literature note" in Obsidian. The Error Message in Obsidian is "annotation key not found".

Full Error Log:

664efdee-c3e0-42a9-b509-be84c98eb2ea:1 [2024-01-14T16:10:41.875] [DEBUG] obsidian-zotero:db-worker - Reading Zotero database for attachments of item 2388
664efdee-c3e0-42a9-b509-be84c98eb2ea:1 [2024-01-14T16:10:41.875] [DEBUG] obsidian-zotero:db-worker - Finished reading Zotero database for attachments of item 2388, count: 1
664efdee-c3e0-42a9-b509-be84c98eb2ea:1 [2024-01-14T16:10:41.875] [DEBUG] obsidian-zotero:db-worker - Reading Zotero database for notes of literature 2388
664efdee-c3e0-42a9-b509-be84c98eb2ea:1 [2024-01-14T16:10:41.875] [DEBUG] obsidian-zotero:db-worker - Finished reading Zotero database for notes of literature 2388, count: 1
664efdee-c3e0-42a9-b509-be84c98eb2ea:1 [2024-01-14T16:10:41.876] [DEBUG] obsidian-zotero:db-worker - Reading Zotero database for attachments of item 2388
664efdee-c3e0-42a9-b509-be84c98eb2ea:1 [2024-01-14T16:10:41.876] [DEBUG] obsidian-zotero:db-worker - Finished reading Zotero database for attachments of item 2388, count: 1
664efdee-c3e0-42a9-b509-be84c98eb2ea:1 [2024-01-14T16:10:41.877] [DEBUG] obsidian-zotero:db-worker - Reading Zotero database for annotations of attachment 2389
664efdee-c3e0-42a9-b509-be84c98eb2ea:1 [2024-01-14T16:10:41.877] [DEBUG] obsidian-zotero:db-worker - Finished reading Zotero database for annotations of attachment 2389, count: 1
664efdee-c3e0-42a9-b509-be84c98eb2ea:1 [2024-01-14T16:10:41.877] [DEBUG] obsidian-zotero:db-worker - Reading Zotero database for tags
664efdee-c3e0-42a9-b509-be84c98eb2ea:1 [2024-01-14T16:10:41.877] [DEBUG] obsidian-zotero:db-worker - Finished reading Zotero database for tags
plugin:zotlit:6 [2024-01-14T16:10:41.877] [ERROR] obsidian-zotero:main - annotation not found, key:  7VTSV58W {
  annotationKey: '7VTSV58W',
  citationKey: '9AA95U4W',
  attachementKey: 'C7YSRPHI',
  commentHTML: '???????????',
  inline: false
}
plugin:zotlit:359 Uncaught (in promise) Error: annotation key not found: 7VTSV58W
    at eval (plugin:zotlit:359:41857)
    at [Symbol.replace] (<anonymous>)
    at String.replaceAll (<anonymous>)
    at ud.turndown (plugin:zotlit:359:41564)
    at async ud.normalizeNotes (plugin:zotlit:359:40190)
    at async BP (plugin:zotlit:350:12566)
    at async Mb.updateNote (plugin:zotlit:359:30819)
    at async n (plugin:zotlit:359:28193)
eval @ plugin:zotlit:359
turndown @ plugin:zotlit:359
await in turndown (async)
eval @ plugin:zotlit:359
e.handleEvent @ app.js:1
click @ app.js:1
apply @ /Applications/Obsidian.app/Contents/Resources/app.asar/node_modules/@electron/remote/dist/src/renderer/callbacks-registry.js:54
(anonymous) @ /Applications/Obsidian.app/Contents/Resources/app.asar/node_modules/@electron/remote/dist/src/renderer/remote.js:346
(anonymous) @ /Applications/Obsidian.app/Contents/Resources/app.asar/node_modules/@electron/remote/dist/src/renderer/remote.js:328
emit @ node:events:513
onMessage @ node:electron/js2c/renderer_init:2
Mizumaky commented 7 months ago

Sharing similar issue: