Template suddenly stops working!

The problem

I have a template that says: take the url in the clipboard, and if it contains the word x, then call template x; if it contains y call template y. The template works for everything but “Letterboxd” (a movie site), pretty much the only site I use it for. I use it every day, at least 10-20 times per day. I was using it all day today until about 3 hours ago when out of the blue it threw an error.

The error

Console says:

Templater Error: Template parsing error, aborting. Cannot read properties of null (reading 'href')

I’m not familiar enough with how the console works to see where else I should look for details.


About the Template:

It works for everything (youtube, imdb, wikipedia) but stopped for Letterboxd 3 hours ago. (I had a Windows Update in the queue, so I updated just in case it was causeing the issue. Made no difference).

<%* 
// https://github.com/SilentVoid13/Templater/discussions/846

let clipboard = await tp.system.clipboard();
clipboard = clipboard.trim(); // remove whitespace from both ends
let urlExpression = /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)?/gmi;
let urlRegex = new RegExp(urlExpression);

if (clipboard.includes("/www.youtube.com/")) {
  // Insert YouTube template
  tR += await tp.file.include("[[youtube template]]");
} else if (clipboard.includes("/www.imdb.com/")) {
  tR += await tp.file.include("[[imdb template]]");
} else if (clipboard.includes("/letterboxd.com/")) {
  tR += await tp.file.include("[[LB template]]");
} else if (clipboard.includes("wikipedia.org/")) {
  tR += await tp.file.include("[[wikipedia template]]");
} else if (clipboard.match(urlRegex)) {
  tR += await tp.file.include("[[website]]");
} else {
  new Notice("No link in the clipboard");
}
%>

Are you sure it’s this template which fails? Do you have template user functions in your vault? Have you updated either of them recently? If they have a fault, it’ll affect all templates.

If not, have you done any changes to this template lately?

Hi Holroy,

I tried in a new vault with nothing but Templater and my script and 2 relevant templates. Same error. In templater the only things I have entered are the template folder and the templater scripts folder. Nothing else. Same error. Youtube and imdb still work fine. It’s just my Letterboxd script and/or template that doesn’t work.

I even went back to a 2 year old vault that worked fine and I get the same error.

I’ve opened a ticket on Github.