calcom/cal.diy · warning · NotFoundException

Booking reference not found

Error message

Booking reference not found

What it means

GoogleCalendarService.getEventDetails throws NotFoundException when getBookingReferencesIncludeSensitiveCredentials(eventUid) returns null. The eventUid passed in does not match any row in the booking references table (the calendar-event pointer stored against a Cal.com booking).

Source

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

import { GoogleCalendarService as GCalService } from "@/platform/calendars/services/gcal.service";
import { GoogleCalendarEventResponse } from "@/modules/cal-unified-calendars/pipes/get-calendar-event-details-output-pipe";
import { CredentialsRepository } from "@/modules/credentials/credentials.repository";

@Injectable()
export class GoogleCalendarService {
  private logger = new Logger("GoogleCalendarService");
  constructor(
    private readonly bookingReferencesRepository: BookingReferencesRepository_2024_08_13,
    private readonly gCalService: GCalService,
    private readonly credentialsRepository: CredentialsRepository
  ) {}

  async getEventDetails(eventUid: string): Promise<GoogleCalendarEventResponse> {
    const bookingReference =
      await this.bookingReferencesRepository.getBookingReferencesIncludeSensitiveCredentials(eventUid);

    if (!bookingReference) {
      throw new NotFoundException("Booking reference not found");
    }

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

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

    try {
      const event = await calendar.events.get({
        calendarId: bookingReference?.externalCalendarId ?? "primary",
        eventId: bookingReference?.uid,
        // fields: "id,status,created,updated,summary,description,location,creator,organizer,start,end,attendees,conferenceData"
      });

View on GitHub (pinned to 176037d0af)

Solutions

  1. Look up the correct uid via the bookings API (GET /v2/bookings) and pass the booking reference's uid, not the booking id.
  2. Confirm the booking was created with a Google Calendar destination.
  3. If the reference was deleted intentionally, treat the event as no-longer-accessible rather than retrying.
Defensive patterns

Strategy: validation

Validate before calling

const refs = await api.v2.bookings.list(/* ... */);
const ref = refs.find(r => r.uid === eventUid);
if (!ref) throw new Error(`No booking reference for uid ${eventUid}; check GET /v2/bookings`);

Try / catch

try {
  await api.v2.calUnified.getEvent(eventUid);
} catch (err) {
  if (err?.statusCode === 404 && /Booking reference not found/i.test(err?.message)) {
    // surface 'unknown event' to the UI rather than retry
  }
  throw err;
}

Prevention

When it happens

Trigger: GET /v2/.../events/:eventUid where eventUid was never created by Cal.com, was for a non-Google calendar, or was deleted. The booking reference is the link between a Cal.com booking and its external Google Calendar event.

Common situations: Passing the booking id instead of the booking reference uid; the booking was created on a different calendar provider; the reference row was pruned; testing with a fabricated uid.

Related errors


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