Foundry376/Mailspring · error
Could not find `important` label
Error message
Could not find `important` label
What it means
Mail-rule action guard (markAsImportant): CategoryStore found no label with role 'important' for the thread's account, so a ChangeLabelsTask cannot be built. Happens when the account's folders/labels haven't synced yet (rule runs at startup) or the provider has no important label.
Source
Thrown at app/src/mail-rules-processor.ts:38
let MailRulesStore: typeof import('./flux/stores/mail-rules-store').default = null;
type MailRule = import('./flux/stores/mail-rules-store').MailRule;
/**
Note: At first glance, it seems like these task factory methods should use the
TaskFactory. Unfortunately, the TaskFactory uses the CategoryStore and other
information about the current view. Maybe after the unified inbox refactor...
*/
const MailRulesActions: {
[action: string]: (
message: Message,
thread: Thread,
value: string
) => undefined | Task | Promise<undefined> | Promise<Task>;
} = {
markAsImportant: async (message, thread) => {
const important = CategoryStore.getCategoryByRole(thread.accountId, 'important');
if (!important) {
throw new Error('Could not find `important` label');
}
return new ChangeLabelsTask({
labelsToAdd: [important],
labelsToRemove: [],
threads: [thread],
source: 'Mail Rules',
});
},
moveToTrash: async (message, thread) => {
const folder = CategoryStore.getTrashCategory(thread.accountId);
if (!folder) {
throw new Error('Could not find `trash` folder');
}
return new ChangeFolderTask({
folder: folder,
threads: [thread],
source: 'Mail Rules',View on GitHub (pinned to 648c685d60)
Solutions
- Wait for folder/label sync to complete before rules run, or retry the rule once categories are cached
- Disable the markAsImportant rule action for account types that don't support labels (e.g. IMAP without an important label)
- Ensure the account's important label exists server-side so it syncs down
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at app/src/mail-rules-processor.ts:38 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/2b6fbbc0996edd7f.
Report an issue: GitHub.