{"record":{"id":"f81f88b9f8bdb2f8","repo":"Foundry376/Mailspring","slug":"the-folder-could-not-be-found","errorCode":null,"errorMessage":"The folder could not be found.","messagePattern":"The folder could not be found\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/src/mail-rules-processor.ts","lineNumber":97,"sourceCode":"    });\n  },\n\n  forward: (message, thread, value) => {\n    Actions.composeAndSendForward({\n      thread: thread,\n      message: message,\n      to: [new Contact({ email: value })],\n    });\n    return undefined;\n  },\n\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],","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/Foundry376/Mailspring/blob/648c685d602ece6bb00c22534b8734de6ac644b3/app/src/mail-rules-processor.ts#L79-L115","documentation":"Mail-rule action guard (changeFolder): a folder value was provided, but CategoryStore.byId returned nothing or a non-Folder category (e.g. a Gmail Label) for the thread's account. The id stored in the rule no longer resolves — the folder was deleted or belongs to a different account.","triggerScenarios":"Thrown at app/src/mail-rules-processor.ts:97 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-select a valid folder in the mail rule editor","Delete the stale rule if the folder was intentionally removed","Validate stored folder ids against the account when rules load and flag broken ones"],"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"}