Bug Report: Frontmatter Added by Templater is Immediately Overwritten on New Note Creation
FYI: Gemini 2.5 Pro via Perplexity Pro generated this for me. I spent well over an hour figuring out a solution before turning to AI for troubleshooting and workarounds. Apologies if it isn’t detailed enough. Happy to fill in the blanks.
Goal:
To automatically add a predefined set of frontmatter properties to any new note created in a specific folder (Projects/The Fourth Man) using Templater’s “Folder Templates” feature.
The Problem:
When a new note is created in the target folder, the Templater script successfully runs and adds the frontmatter, but the frontmatter is immediately erased from the file.
Key Symptom:
After the frontmatter disappears, pressing Cmd+Z (Undo) makes the correct frontmatter reappear. This confirms the frontmatter is being written, but it is being instantly overwritten by a subsequent, likely empty, write operation.
What Has Been Tried & Confirmed:
Verified Templater Setup: “Trigger on new file creation” is enabled. The Folder Template mapping is correct (Projects/The Fourth Man → template.md).
Confirmed Core Functionality: A minimal test case with a simple template (tR += "Hello") works perfectly, proving the trigger and mapping features are functional.
Attempted Multiple Scripting Methods:
Simple tR += string concatenation.
Using the official app.fileManager.processFrontMatter() API to avoid race conditions.
Adding an await delay (setTimeout) to the end of the script.
All methods result in the same “write-and-disappear” behavior.
Isolated Plugin Conflicts:
The issue persists even with all community plugins disabled except for Templater.
A console error from auto-note-mover was initially identified, but disabling the plugin did not solve the underlying overwrite problem.
The issue seems to be a fundamental race condition between Templater’s processFrontMatter API call and the finalization of the “new note” creation event in Obsidian itself.
I tried and I can’t reproduce. You did not fill the bug report template, so we have limited information to work with.
What’s the out of “show debug info”?
Where is your vault stored?
Does this happen in the sandbox vault with templater?
In a vault with only templater enabled, restart obsidian, then please post a screen recording showing your settings for reproduction and this bug happening as you described it.
Thank you! This is my first bug “report”, so I appreciate the next steps
The out is “{Project} properties added}” when the file is created. That always appears and properties are added, but only because it precedes the sudden wipe.
My vault is stored locally. I sub to Sync, but didn’t run it during the work of this.
It did. However, I have a feeling there was one setting that might have clashed with this. I’ll retest.
To respect everyone’s time, I’ll try out a few more tests, then fill out the template if needed. I’ll make sure to post an update.
I tested in a sandboxed vault, and the issue was Templater’s execution lifecycle. The template script finishes its execution before Obsidian’s own new file creation process is fully complete and saved.
I think instead of self-diagnosing the problem (or to be more precise have the AI diagnose it for you) , you should really open BR to templater and let them know how to reproduce the problem.
I couldn’t reproduce the problem with the steps you outlined in the first post.