Foundry376/Mailspring · error
Unknown mail rule condition template: ${condition.templateKe
Error message
Unknown mail rule condition template: ${condition.templateKey} What it means
Warning (not a throw) logged by _checkRuleForMessage when a stored rule condition references a templateKey absent from the ConditionTemplates registry — e.g. a rule created by a different app version or removed condition type. The condition cannot be evaluated, so it cannot contribute to the rule matching.
Source
Thrown at app/src/mail-rules-processor.ts:226
for (const t of ConditionTemplates) {
this._conditionTemplateMap.set(t.key, t);
}
}
return this._conditionTemplateMap;
}
_checkRuleForMessage(rule: MailRule, message: Message) {
const fn =
rule.conditionMode === ConditionMode.All ? Array.prototype.every : Array.prototype.some;
if (message.accountId !== rule.accountId) {
return false;
}
const templateMap = this._getConditionTemplateMap();
return fn.call(rule.conditions, (condition) => {
const template = templateMap.get(condition.templateKey);
if (!template) {
console.warn(`Unknown mail rule condition template: ${condition.templateKey}`);
return false;
}
const value = template.valueForMessage(message);
return template.evaluate(condition, value);
});
}
async _applyRuleToMessage(rule: MailRule, message: Message, thread: Thread) {
try {
const actionPromises = rule.actions.map((action) => {
const actionFn = MailRulesActions[action.templateKey];
if (!actionFn) {
throw new Error(`${action.templateKey} is not a supported action.`);
}
return actionFn(message, thread, action.value);
});
const actionResults = await Promise.all<Task | undefined>(actionPromises);View on GitHub (pinned to 648c685d60)
Solutions
- Edit the rule in Preferences > Mail Rules and re-select the condition
- Update Mailspring to a version that includes the condition template
- Delete and recreate the affected rule
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at app/src/mail-rules-processor.ts:226 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Foundry376/Mailspring@648c685d60 (2026-09-03).
Data as JSON: /api/errors/84f017894c2abcd6.
Report an issue: GitHub.