Foundry376/Mailspring · error

The label could not be found.

Error message

The label could not be found.

What it means

Lookup failure in the applyLabel action handler: the rule supplies a label id, but CategoryStore.byId returns no category for it, or the returned category is not a Label instance (e.g. it resolves to a Folder/mailbox on IMAP accounts). Fires when the referenced label was deleted or the rule references a category of the wrong kind.

Source

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

    }
    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');
    }
    return new ChangeLabelsTask({
      labelsToAdd: [],
      labelsToRemove: [inbox],
      threads: [thread],

View on GitHub (pinned to 648c685d60)

Solutions

  1. Edit the rule in Preferences > Mail Rules and re-select an existing label
  2. Recreate the deleted label on the account, or point the rule at another label
  3. Check that the account type actually supports labels (Gmail) rather than folders
Defensive patterns

Strategy: validation

When it happens

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