Foundry376/Mailspring · error

A folder is required.

Error message

A folder is required.

What it means

Mail-rule action guard (changeFolder): the rule's condition value — the destination folder id — is empty, so there is nothing to look up in CategoryStore. Means the rule was saved without choosing a target folder for its change-folder action.

Source

Thrown at app/src/mail-rules-processor.ts:93

    return new ChangeStarredTask({
      starred: true,
      threads: [thread],
      source: 'Mail Rules',
    });
  },

  forward: (message, thread, value) => {
    Actions.composeAndSendForward({
      thread: thread,
      message: message,
      to: [new Contact({ email: value })],
    });
    return undefined;
  },

  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)) {

View on GitHub (pinned to 648c685d60)

Solutions

  1. Edit the mail rule and select a destination folder for the change-folder action
  2. Require a folder selection in the rule editor before the rule can be saved
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at app/src/mail-rules-processor.ts:93 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/897d96b7ea8f34a4. Report an issue: GitHub.