Templater aborting, tp.user.header is not a function?

I want to create a new note from my imported notes in Zotero using a script with Templater

I followed the steps in this 01 Notetaking for Historians - Doing History with Zotero and Obsidian - Obsidian Publish walkthrough to set up Templater in Obsidian with Zotero files. The console says tp.user.header is not a function. What do I need to fix?

Things I have tried

Emailed the original author of the walkthrough.

I can get the Zotero annotations into Obsidian without any issues, but the script breaks when I try to create a new note with my highlighted annotations.

The tp.user.header is a user defined function related to Templater, and you need to follow the instructions far down on the page you linked to:

There it explains how to set up this user defined function for Templater. Follow that setup, and hopefully you’ll get everything going smoothly.

1 Like

I’m having the same trouble. In the Obsidian Developer Console I get

Templater Error: Template parsing error, aborting. tp.user.header is not a function.

I’ve made the requisite header.js user-defined script and pointed templater to the relevant folder containing it. Problem is, when I hit the Refresh button in Templater’s settings pane I get “Detected 0 User Script(s)”.

1 Like

I fixed it! I had made the header.js file in Obsidian, and Obsidian added .md to the filename (by default) so that it was in the scripts folder as header.js.md. I quit Obsidian, deleted the “.md” from the filename in the Finder(macOS), rebooted, and it worked. In the preference pane it now reads:

Detected 1 User Script(s): tp.user.header

1 Like

Thank you for the reply. I believe I followed the instructions correctly, but I will double check. JBTaylor124 suggested something that I will try.

Thank you for troubleshooting! I’ll try the same thing on my PC.

In obsidian, you can right click on the script file and select “open in system explorer” then delete the .md extension. It works!

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