Error exporting citations and bibliography via Enhancing Exports/Pandoc

What I’m trying to do

I’m trying to export a document from Markdown to produce a Word (.docx) document with citations and a reference list. I’m using the Enhancing Exports plugin with these extra arguments in the plugin settings:

–metadata bibliography=C:\xxxxxxxxx\My_Library.json --citeproc --csl=C:\xxxxxxxxx\apa.csl

My_Library.json is a file autoexported from Zotero via Better BibTex. The format is Better CSL JSON format.

For example, a Markdown document looking like this

Hi! [@smith2024booktitle]

would render me a Word document reading:

Hi! (Smith, 2024)
Smith, J. (2024). Book title. Publisher name.

This has worked perfectly in the past, but now the export fails and I keep getting this error:

Error reading bibliography file C:\xxxxxxxxxxxx\My_Library.json: Error in $[529][‘date-parts’][0]: not a number.

Things I have tried

I have tried

  • Updating Pandoc
  • Updating Obsidian and all plugins
  • Re-exported my Zotero library in Better CSL JSON format several times.
  • Trying to export the same Markdown file via Zettlr using (1) Pandoc and (2) Zettlr’s internal Pandoc (and getting the same error message in both cases).

The problem seems to lie in Pandoc’s inability to interpret the JSON file, but I cannot find any information about how to fix it. Again, this procedure used to work before, but it doesn’t any longer, which makes me think I’ve screwed something up on the Obsidian end. Happy for help with any solutions or workarounds to get my documents exported and properly formated.

This seems to indicate that there is an issue in line 529 in the json bibliography file. Can you try opening the file in a text editor, like notepad or VS Code, finding the line in question and checking it for issues? You can share that line / entry here, if you are comfortable doing that.

By the way, it’s possible to have Pandoc create Word documents that have live citations, like you get from the Zotero addon for Word, e.g. where you can change the citation style and update the bibliography. For that, you need some different arguments. See my walkthrough here, if this is of interest to you: Exporting with citations - #5 by Feralflora

You were right! It turns out that NotePad adds two lines to the count so I was scratching my head over the wrong line… However, I found that the problem was that an item in Zotero had the publication year set to “XXXX” (for some unknown reason). This turned into “-1” in the JSON file’s date-parts for the item. I adjusted the date and now things are back to normal again!

1 Like

Thanks, definitely gonna check it out!

You’re welcome! I’m glad you got it sorted out. Thanks for reporting back with the details of how your resolved the issue.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.