{"record":{"id":"92e295c00ed71bf1","repo":"Foundry376/Mailspring","slug":"invalid-ics-expected-vcalendar-root","errorCode":null,"errorMessage":"Invalid ICS: expected VCALENDAR root","messagePattern":"Invalid ICS: expected VCALENDAR root","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/src/ics-event-helpers.ts","lineNumber":672,"sourceCode":" * @param edits - Property values to apply\n * @returns Updated master ICS string\n */\nexport function applyEditsToException(\n  masterIcs: string,\n  recurrenceId: string,\n  edits: {\n    summary?: string;\n    location?: string;\n    description?: string;\n    attendees?: Array<{ email: string; name?: string | null; partstat?: string }>;\n  }\n): string {\n  const ical = getICAL();\n  const { root } = parseICSString(masterIcs);\n\n  const vcalendar = root.name === 'vcalendar' ? root : null;\n  if (!vcalendar) {\n    throw new Error('Invalid ICS: expected VCALENDAR root');\n  }\n\n  // Find the exception VEVENT by RECURRENCE-ID\n  let exceptionVevent: ICALComponent | null = null;\n  for (const vevent of vcalendar.getAllSubcomponents('vevent')) {\n    const rid = vevent.getFirstPropertyValue('recurrence-id');\n    if (rid) {\n      const ridStr =\n        typeof rid === 'string'\n          ? rid\n          : typeof (rid as any).toString === 'function'\n            ? (rid as any).toString()\n            : String(rid);\n      if (\n        ridStr === recurrenceId ||\n        ridStr.replace(/[^0-9TZ]/g, '') === recurrenceId.replace(/[^0-9TZ]/g, '')\n      ) {\n        exceptionVevent = vevent;","sourceCodeStart":654,"sourceCodeEnd":690,"githubUrl":"https://github.com/Foundry376/Mailspring/blob/648c685d602ece6bb00c22534b8734de6ac644b3/app/src/ics-event-helpers.ts#L654-L690","documentation":"Guard in applyEditsToException: the parsed ICS root component is not a VCALENDAR (or has no VCALENDAR wrapper), which this routine requires to search for exception VEVENTs. Usually means a bare-VEVENT payload was passed where a full calendar wrapper was expected.","triggerScenarios":"Thrown at app/src/ics-event-helpers.ts:672 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass the full VCALENDAR ICS (BEGIN:VCALENDAR ... END:VCALENDAR) rather than a bare VEVENT","Wrap the parsed event in a VCALENDAR component before calling applyEditsToException"],"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"}