{"record":{"id":"f21703424596fc87","repo":"Foundry376/Mailspring","slug":"a-label-is-required","errorCode":null,"errorMessage":"A label is required.","messagePattern":"A label is required\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/src/mail-rules-processor.ts","lineNumber":108,"sourceCode":"\n  changeFolder: async (message, thread, value) => {\n    if (!value) {\n      throw new Error('A folder is required.');\n    }\n    const folder = CategoryStore.byId(thread.accountId, value);\n    if (!folder || !(folder instanceof Folder)) {\n      throw new Error('The folder could not be found.');\n    }\n    return new ChangeFolderTask({\n      folder: folder,\n      threads: [thread],\n      source: 'Mail Rules',\n    });\n  },\n\n  applyLabel: async (message, thread, value) => {\n    if (!value) {\n      throw new Error('A label is required.');\n    }\n    const label = CategoryStore.byId(thread.accountId, value);\n    if (!label || !(label instanceof Label)) {\n      throw new Error('The label could not be found.');\n    }\n    return new ChangeLabelsTask({\n      labelsToAdd: [label],\n      labelsToRemove: [],\n      threads: [thread],\n      source: 'Mail Rules',\n    });\n  },\n\n  archive: (message, thread) => {\n    const inbox = CategoryStore.getInboxCategory(thread.accountId);\n    if (!inbox) {\n      throw new Error('Could not find `inbox` label');\n    }","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/Foundry376/Mailspring/blob/648c685d602ece6bb00c22534b8734de6ac644b3/app/src/mail-rules-processor.ts#L90-L126","documentation":"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.","triggerScenarios":"Thrown at app/src/mail-rules-processor.ts:108 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"648c685d602ece6bb00c22534b8734de6ac644b3","analyzedAt":"2026-09-03T02:00:24.311Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T07:17:11.731Z"}