Foundry376/Mailspring · error
A label is required.
Error message
A label is required.
What it means
Validation guard in the MailRuleProcessor's applyLabel action handler. It fires when a mail rule's 'apply label' action has an empty/missing value — the rule was saved without a label id, or the stored label id is an empty string.
Source
Thrown at app/src/mail-rules-processor.ts:108
changeFolder: async (message, thread, value) => {
if (!value) {
throw new Error('A folder is required.');
}
const folder = CategoryStore.byId(thread.accountId, value);
if (!folder || !(folder instanceof Folder)) {
throw new Error('The folder could not be found.');
}
return new ChangeFolderTask({
folder: folder,
threads: [thread],
source: 'Mail Rules',
});
},
applyLabel: async (message, thread, value) => {
if (!value) {
throw new Error('A label is required.');
}
const label = CategoryStore.byId(thread.accountId, value);
if (!label || !(label instanceof Label)) {
throw new Error('The label could not be found.');
}
return new ChangeLabelsTask({
labelsToAdd: [label],
labelsToRemove: [],
threads: [thread],
source: 'Mail Rules',
});
},
archive: (message, thread) => {
const inbox = CategoryStore.getInboxCategory(thread.accountId);
if (!inbox) {
throw new Error('Could not find `inbox` label');
}View on GitHub (pinned to 648c685d60)
Solutions
- Open Preferences > Mail Rules and edit the rule so the 'apply label' action has a label selected
- Delete or disable the malformed rule if it is no longer needed
- If programmatically creating rules, ensure each applyLabel action includes a valid label id
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at app/src/mail-rules-processor.ts:108 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/f21703424596fc87.
Report an issue: GitHub.