calcom/cal.diy · error · NotFoundException

Booking with uid ${bookingUid} not found

Error message

Booking with uid ${bookingUid} not found

What it means

Thrown by BookingsService.getCalendarLinks when getByUidWithAttendeesAndUserAndEvent(bookingUid) returns null. NestJS NotFoundException (HTTP 404). The booking uid supplied to the calendar-links endpoint does not exist, so no calendar links can be generated.

Source

Thrown at apps/api/v2/src/platform/bookings/2024-08-13/services/bookings.service.ts:1197

        bookingId: booking.id,
        confirmed: false,
        recurringEventId: booking.recurringEventId ?? undefined,
        reason,
        emailsEnabled,
        platformClientParams,
        actionSource: "API_V2",
        actor: makeUserActor(requestUser.uuid),
      },
    });

    return this.getBooking(bookingUid, requestUser);
  }

  async getCalendarLinks(bookingUid: string): Promise<CalendarLink[]> {
    const booking = await this.bookingsRepository.getByUidWithAttendeesAndUserAndEvent(bookingUid);

    if (!booking) {
      throw new NotFoundException(`Booking with uid ${bookingUid} not found`);
    }

    if (!booking.eventTypeId) {
      throw new BadRequestException(`Booking with uid ${bookingUid} has no event type`);
    }

    const eventType = await this.eventTypesRepository.getEventTypeByIdIncludeUsersAndTeam(
      booking.eventTypeId
    );
    if (!eventType) {
      throw new BadRequestException(`Booking with uid ${bookingUid} has no event type`);
    }
    // TODO: Maybe we should get locale from query params?
    return getCalendarLinks({
      booking,
      eventType: {
        ...eventType,
        // TODO: Support dynamic event bookings later. It would require a slug input it seems

View on GitHub (pinned to 176037d0af)

Solutions

  1. Verify the booking exists with GET /v2/bookings/{uid} before requesting calendar links.
  2. Regenerate the uid from the authoritative booking response rather than cached state.
  3. Handle 404 gracefully by hiding the calendar-link UI for missing bookings.
  4. Confirm environment consistency.

Example fix

// before
const links = await apiClient.get(`/v2/bookings/${uid}/calendar-links`);

// after
const booking = await apiClient.get(`/v2/bookings/${uid}`).then(r => r.data).catch(() => null);
if (!booking) return [];
const links = await apiClient.get(`/v2/bookings/${uid}/calendar-links`);
Defensive patterns

Strategy: validation

Validate before calling

const booking = await apiClient.get(`/v2/bookings/${uid}`).then(r => r.data).catch(() => null);
if (!booking) { console.warn(`Booking ${uid} missing - no calendar links`); return []; }

Type guard

function isBookingUid(value: string): boolean {
  return typeof value === 'string' && /^[A-Za-z0-9_-]{8,}$/.test(value.trim());
}

Try / catch

try {
  return await apiClient.get(`/v2/bookings/${uid}/calendar-links`).then(r => r.data);
} catch (err) {
  if (err.response?.status === 404) return [];
  throw err;
}

Prevention

When it happens

Trigger: GET /v2/bookings/{uid}/calendar-links with a non-existent bookingUid; booking deleted before the call.

Common situations: Generating add-to-calendar links from stale client state; referencing a draft booking that was never persisted; environment mismatch.

Related errors


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