Templater
Templater copied to clipboard
Template works in one vault, not in the other
Two vaults, both on the same machine using the same instance of obsidian. They each have the identical daily-note-template. One works just fine, in the other vault I get :
VM165:42252 Uncaught (in promise) TypeError: Cannot destructure property 'basename' of 'app.workspace.getActiveFile(...)' as it is null.
at instance$1 (eval at <anonymous> (app.js:1:1433712), <anonymous>:42252:8)
at init (eval at <anonymous> (app.js:1:1433712), <anonymous>:3887:11)
at new SideTree (eval at <anonymous> (app.js:1:1433712), <anonymous>:42317:3)
at TreeView.draw (eval at <anonymous> (app.js:1:1433712), <anonymous>:42347:21)
at refreshIndex (eval at <anonymous> (app.js:1:1433712), <anonymous>:35414:94)
at async eval (eval at <anonymous> (app.js:1:1433712), <anonymous>:64349:17)
app.js:1 Uncaught TypeError: Cannot read properties of null (reading 'basename')
at eval (eval at <anonymous> (app.js:1:1433712), <anonymous>:42256:59)
at t.e.tryTrigger (app.js:1:838297)
at t.e.trigger (app.js:1:838230)
at t.trigger (app.js:1:1406877)
at t.activeLeafEvents (app.js:1:1398843)
at a (app.js:1:233024)
app.js:1 Uncaught TypeError: Cannot read properties of null (reading 'basename')
at eval (eval at <anonymous> (app.js:1:1433712), <anonymous>:42256:59)
at t.e.tryTrigger (app.js:1:838297)
at t.e.trigger (app.js:1:838230)
at t.trigger (app.js:1:1406877)
at t.activeLeafEvents (app.js:1:1398843)
at a (app.js:1:233024)
VM146:82 Templater Error: Template parsing error, aborting.
"" is not a function
log_error @ VM146:82
---
parent: [[[[Daily Notes]]]]
obsidianUIMode: preview
tags:
- daily_note
prev: [[<% tp.date.now("YYYY-MM-DD", -1) %>]]
---
<div id="daily_note_wrapper"><span class="daily_note_date"><% tp.date.now("ddd MMMM Do, YYYY") %></span></div>
<span class="daily_nav_link"><< [[<% tp.date.now("YYYY-MM-DD", -1) %>|Yesterday]] | [[<% tp.date.now("YYYY-MM-DD", 1) %>|Tomorrow]]>></span>
```ad-note
title: Notes
collapse: none
add notes here
```
````ad-overdue
collapse: open
```tasks
not done
due before {{date}}
```
````
````ad-today
collapse: open
```tasks
not done
due after {{date-1d}}
due before {{date+1d}}
```
````
````ad-upcoming
collapse: open
```tasks
not done
due after {{date}}
due before {{date+7d}}
```
````
```ad-quote
<%await tp.file.include("[[get_quote.js]]")%>
```
%% Task Syntax
- [ ] #task new task for today, due next week 🔼 ⏳ 2021-11-05 📅 2021-11-10
%%
I forgot to add, this templte is being fired by the Periodic Notes template when the calendar data is clicked on.
It looks like the error that you pasted is being triggered by the Breadcrumbs plugin. Could you test to see if the template works with that plugin disabled?
Disabled Breadcrumbs and get the same error. :-/
Can you try restarting after disabling Breadcrumbs then paste the error message again? If it's not related to the Breadcrumbs plugin, it will still be easier to diagnose the issue if there aren't unrelated errors included.
Sorry, this started working when I made some other changes. I am not sure what caused it, nor what actually fixed it. :-/