calcom/cal.diy · error · NotFoundException

Failed to update meeting

Error message

Failed to update meeting

What it means

GoogleCalendarService.updateEventDetails throws NotFoundException('Failed to update meeting') when calendar.events.patch resolves but returns no event.data. The PATCH succeeded at the transport level but yielded an empty body, treated by the service as a failed update.

Source

Thrown at apps/api/v2/src/modules/cal-unified-calendars/services/google-calendar.service.ts:95

    const ownerUserEmail = bookingReference?.booking?.user?.email;

    const calendar = await this.getAuthorizedCalendarInstance(
      ownerUserEmail,
      bookingReference.credential?.key,
      bookingReference.delegationCredential
    );

    const updatePayload = new GoogleCalendarEventInputPipe().transform(updateData);

    try {
      const event = await calendar.events.patch({
        calendarId: bookingReference?.externalCalendarId ?? "primary",
        eventId: bookingReference?.uid,
        requestBody: updatePayload,
      });

      if (!event.data) {
        throw new NotFoundException("Failed to update meeting");
      }
      return event.data as GoogleCalendarEventResponse;
    } catch (error) {
      throw new NotFoundException("Failed to update meeting details");
    }
  }

  /**
   * Gets an authorized Google Calendar instance
   * Tries delegation credentials first, falls back to direct OAuth
   */
  private async getAuthorizedCalendarInstance(
    userEmail?: string,
    oAuthCredentials?: Prisma.JsonValue | undefined,
    delegationCredential?: { id: string } | null
  ): Promise<calendar_v3.Calendar> {
    if (userEmail && delegationCredential?.id) {
      const delegatedCalendar = await this.getDelegatedCalendarInstance(delegationCredential, userEmail);

View on GitHub (pinned to 176037d0af)

Solutions

  1. Re-fetch the event to confirm it still exists before patching (optimistic-concurrency).
  2. Retry once; if it persists, surface to the user that the meeting is no longer available.
  3. Verify externalCalendarId/uid on the reference are still valid against the live calendar.
Defensive patterns

Strategy: retry

Validate before calling

// Re-check existence right before patching to avoid the empty-response branch
const stillExists = await calendar.events.get({ calendarId, eventId }).then(r => !!r.data).catch(() => false);
if (!stillExists) throw new Error('Meeting vanished before update; aborting');

Try / catch

try {
  return await api.v2.calUnified.updateEvent(eventUid, patch);
} catch (err) {
  if (err?.statusCode === 404 && /Failed to update meeting$/i.test(err?.message)) {
    // one retry after re-verifying the event exists
  }
  throw err;
}

Prevention

When it happens

Trigger: A patch against an event id that Google silently does not return (event deleted between the get and patch, or patched against a calendar where the event no longer exists).

Common situations: Race: the event was deleted in Google between the booking-reference lookup and the patch; calendar recreated; partial Google outage returning empty bodies.

Related errors


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