Foundry376/Mailspring · error
Could not find `trash` folder
Error message
Could not find `trash` folder
What it means
Mail-rule action guard (moveToTrash): CategoryStore.getTrashCategory returned nothing for the thread's account, so the trash folder to move to is unknown. Typically fires before the folder list has synced or on accounts where no folder has been marked with the trash role.
Source
Thrown at app/src/mail-rules-processor.ts:51
) => 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',
});
},
markAsRead: (message, thread) => {
if (thread.unread === false) {
return null;
}
return new ChangeUnreadTask({
unread: false,
threads: [thread],
source: 'Mail Rules',
});
},View on GitHub (pinned to 648c685d60)
Solutions
- Verify the account has a folder mapped to the trash role (set it in account settings/folder mapping)
- Retry once folder sync completes at startup
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at app/src/mail-rules-processor.ts:51 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/f6a3a1a70b4e257f.
Report an issue: GitHub.