{"record":{"id":"140ed6394908c347","repo":"calcom/cal.diy","slug":"no-calendar-id-provided-in-updateevent","errorCode":null,"errorMessage":"no calendar id provided in updateEvent","messagePattern":"no calendar id provided in updateEvent","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/app-store/feishucalendar/lib/CalendarService.ts","lineNumber":214,"sourceCode":"\n    return handleFeishuError<CreateAttendeesResp>(attendeeResponse, this.log);\n  };\n\n  /**\n   * @param uid\n   * @param event\n   * @returns\n   */\n  async updateEvent(uid: string, event: CalendarServiceEvent, externalCalendarId?: string) {\n    const eventId = uid;\n    let eventRespData;\n    const mainHostDestinationCalendar = event.destinationCalendar?.find(\n      (cal) => cal.externalId === externalCalendarId\n    );\n    const calendarId = externalCalendarId || mainHostDestinationCalendar?.externalId;\n    if (!calendarId) {\n      this.log.error(\"no calendar id provided in updateEvent\");\n      throw new Error(\"no calendar id provided in updateEvent\");\n    }\n    try {\n      const eventResponse = await this.fetcher(\n        `/calendar/v4/calendars/${calendarId}/events/${eventId}/patch_event`,\n        {\n          method: \"PATCH\",\n          body: JSON.stringify(this.translateEvent(event)),\n        }\n      );\n      eventRespData = await handleFeishuError<CreateEventResp>(eventResponse, this.log);\n    } catch (error) {\n      this.log.error(error);\n      throw error;\n    }\n\n    try {\n      // Since attendees cannot be changed any more, updateAttendees is not needed\n      // await this.updateAttendees(event, eventId);","sourceCodeStart":196,"sourceCodeEnd":232,"githubUrl":"https://github.com/calcom/cal.diy/blob/176037d0afbe572f870a3c702985e7cd83fe6c0c/packages/app-store/feishucalendar/lib/CalendarService.ts#L196-L232","documentation":"Thrown by FeishuCalendarService.updateEvent when neither the externalCalendarId argument nor a matching destinationCalendar.externalId is present. updateEvent is called during booking reschedule/update; without a target calendar id, the patch cannot be applied.","triggerScenarios":"Reschedule/update flow calling updateEvent(uid, event) with externalCalendarId undefined AND event.destinationCalendar containing no entry whose externalId matches (or destinationCalendar undefined).","commonSituations":"Booking updated after the user removed their Feishu destinationCalendar; externalCalendarId not threaded through from the booking reference; destinationCalendar.externalId mismatch between event types and connected calendars.","solutions":["Pass externalCalendarId from the stored booking reference into updateEvent.","Ensure the user's destinationCalendar for the Feishu credential is set and persistent.","Validate destinationCalendar.externalId presence before invoking updateEvent and surface a user-facing error if missing.","If the calendar genuinely no longer exists, fall back to createEvent (re-create) or skip with a warning."],"exampleFix":"// before\nconst calendarId = externalCalendarId || mainHostDestinationCalendar?.externalId;\nif (!calendarId) {\n  this.log.error(\"no calendar id provided in updateEvent\");\n  throw new Error(\"no calendar id provided in updateEvent\");\n}\n\n// after - typed guard with user-facing cause\nif (!calendarId) {\n  throw new Error(`Cannot update Feishu event ${uid}: no target calendar id (externalCalendarId absent and destinationCalendar has no matching externalId).`);\n}","handlingStrategy":"validation","validationCode":"if (!externalCalendarId) {\n  const dest = event.destinationCalendar?.find((c) => c.externalId);\n  if (!dest?.externalId) throw new Error(\"Cannot update Feishu event: no target calendar id.\");\n}","typeGuard":"const hasUpdateTarget = (event: CalendarServiceEvent, externalCalendarId?: string): boolean =>\n  typeof externalCalendarId === \"string\" && externalCalendarId.length > 0 ||\n  (Array.isArray(event.destinationCalendar) && event.destinationCalendar.some((c) => typeof c.externalId === \"string\" && c.externalId.length > 0));","tryCatchPattern":"if (!calendarId) {\n  throw new Error(`Cannot update Feishu event ${uid}: no calendar id. Re-link the destination calendar.`);\n}","preventionTips":["Thread externalCalendarId from the booking reference into updateEvent.","Validate destinationCalendar.externalId in booking preflight.","Surface missing calendar as user-actionable, not a generic 500."],"tags":["feishu","larksuite","calendar","update-event","destination-calendar","validation"],"backgroundTag":null,"analyzedSha":"176037d0afbe572f870a3c702985e7cd83fe6c0c","analyzedAt":"2026-08-12T19:12:41.464Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}