calcom/cal.diy · error · Error

no calendar id provided in updateEvent

Error message

no calendar id provided in updateEvent

What it means

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.

Source

Thrown at packages/app-store/feishucalendar/lib/CalendarService.ts:214

    return handleFeishuError<CreateAttendeesResp>(attendeeResponse, this.log);
  };

  /**
   * @param uid
   * @param event
   * @returns
   */
  async updateEvent(uid: string, event: CalendarServiceEvent, externalCalendarId?: string) {
    const eventId = uid;
    let eventRespData;
    const mainHostDestinationCalendar = event.destinationCalendar?.find(
      (cal) => cal.externalId === externalCalendarId
    );
    const calendarId = externalCalendarId || mainHostDestinationCalendar?.externalId;
    if (!calendarId) {
      this.log.error("no calendar id provided in updateEvent");
      throw new Error("no calendar id provided in updateEvent");
    }
    try {
      const eventResponse = await this.fetcher(
        `/calendar/v4/calendars/${calendarId}/events/${eventId}/patch_event`,
        {
          method: "PATCH",
          body: JSON.stringify(this.translateEvent(event)),
        }
      );
      eventRespData = await handleFeishuError<CreateEventResp>(eventResponse, this.log);
    } catch (error) {
      this.log.error(error);
      throw error;
    }

    try {
      // Since attendees cannot be changed any more, updateAttendees is not needed
      // await this.updateAttendees(event, eventId);

View on GitHub (pinned to 176037d0af)

Solutions

  1. Pass externalCalendarId from the stored booking reference into updateEvent.
  2. Ensure the user's destinationCalendar for the Feishu credential is set and persistent.
  3. Validate destinationCalendar.externalId presence before invoking updateEvent and surface a user-facing error if missing.
  4. If the calendar genuinely no longer exists, fall back to createEvent (re-create) or skip with a warning.

Example fix

// before
const calendarId = externalCalendarId || mainHostDestinationCalendar?.externalId;
if (!calendarId) {
  this.log.error("no calendar id provided in updateEvent");
  throw new Error("no calendar id provided in updateEvent");
}

// after - typed guard with user-facing cause
if (!calendarId) {
  throw new Error(`Cannot update Feishu event ${uid}: no target calendar id (externalCalendarId absent and destinationCalendar has no matching externalId).`);
}
Defensive patterns

Strategy: validation

Validate before calling

if (!externalCalendarId) {
  const dest = event.destinationCalendar?.find((c) => c.externalId);
  if (!dest?.externalId) throw new Error("Cannot update Feishu event: no target calendar id.");
}

Type guard

const hasUpdateTarget = (event: CalendarServiceEvent, externalCalendarId?: string): boolean =>
  typeof externalCalendarId === "string" && externalCalendarId.length > 0 ||
  (Array.isArray(event.destinationCalendar) && event.destinationCalendar.some((c) => typeof c.externalId === "string" && c.externalId.length > 0));

Try / catch

if (!calendarId) {
  throw new Error(`Cannot update Feishu event ${uid}: no calendar id. Re-link the destination calendar.`);
}

Prevention

When it happens

Trigger: Reschedule/update flow calling updateEvent(uid, event) with externalCalendarId undefined AND event.destinationCalendar containing no entry whose externalId matches (or destinationCalendar undefined).

Common situations: 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.

Related errors


AI-assisted analysis of calcom/cal.diy@176037d0af (2026-08-12). Data as JSON: /api/errors/140ed6394908c347. Report an issue: GitHub.