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
632 stars 28 forks source link

Error: Unexpected annotation data: annotationKey must be defined #237

Open lossfunc opened 10 months ago

lossfunc commented 10 months ago

zotero 导出 obsidian 后,有时候在 obsidian 那边删了,重新在 zotero 那边新建Note,就会失败,console 信息:plugin:zotlit:333 Uncaught (in promise) Error: Unexpected annotation data: annotationKey must be defined

DennisFriedl commented 6 months ago

Same problem here.

DennisFriedl commented 6 months ago

I'm getting this error with many of my Zotero items now. Here are the logs in the console:

[2024-02-12T11:56:55.917] [ERROR] obsidian-zotero:main - Unexpected annotation data {
  attachmentURI: 'http://zotero.org/users/3906100/items/RM9ABLY8',
  pageLabel: '91',
  position: { pageIndex: 14, rects: [ [Array] ] },
  citationItem: {
    uris: [ 'http://zotero.org/users/3906100/items/I5G83YI6' ],
    locator: '91'
  }
} nh(1) [
  co {
    code: 'missing',
    path: We(1) [ 'annotationKey' ],
    data: undefined,
    source: undefined,
    writers: {
      mustBe: [Function: mustBe],
      writeReason: [Function: writeReason],
      addContext: [Function: cI]
    },
    parts: undefined
  },
  byPath: {
    annotationKey: co {
      code: 'missing',
      path: [We],
      data: undefined,
      source: undefined,
      writers: [Object],
      parts: undefined
    }
  },
  count: 1
]

and

plugin:zotlit:363 Uncaught (in promise) Error: Unexpected annotation data: annotationKey must be defined
    at yM (plugin:zotlit:363:388)
    at Object.replacement (plugin:zotlit:359:39872)
    at k.D (turndown.js:2:9551)
    at turndown.js:2:9210
    at NodeList.reduce (<anonymous>)
    at k.b (turndown.js:2:9059)
    at k.D (turndown.js:2:9459)
    at turndown.js:2:9210
    at NodeList.reduce (<anonymous>)
    at k.b (turndown.js:2:9059)
DennisFriedl commented 4 months ago

I know when the error occurs now:

  1. Create a note as attachment to a Zotero item
  2. Quote parts of the document in this note which are linked to the pages of the document
  3. Try to create a literature note for that item -> Error

Workaround: Go to the quotes in the note -> rightclick -> Unlink. When you unlinked all quotes you can create a literature note.