calcom/cal.diy · error · NotFoundException

Booking with uid ${bookingUid} not found

Error message

Booking with uid ${bookingUid} not found

What it means

Thrown in BookingReferencesService.getBookingReferences when getByUidWithUser returns no booking for the supplied UID. The booking-references GET endpoint first resolves the booking; a missing booking is HTTP 404 before any reference lookup.

Source

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

import { Injectable, NotFoundException, BadRequestException } from "@nestjs/common";

@Injectable()
export class BookingReferencesService_2024_08_13 {
  constructor(
    private readonly bookingsRepository: BookingsRepository_2024_08_13,
    private readonly bookingReferencesRepository: BookingReferencesRepository_2024_08_13,
    private readonly outputBookingReferencesService: OutputBookingReferencesService_2024_08_13
  ) {}

  async getBookingReferences(
    bookingUid: string,
    userId: number,
    filter?: BookingReferencesFilterInput_2024_08_13
  ) {
    const booking = await this.bookingsRepository.getByUidWithUser(bookingUid);

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

    if (booking.user?.id !== userId) {
      throw new BadRequestException(`Booking with uid ${bookingUid} does not belong to user`);
    }

    const bookingReferences = await this.bookingReferencesRepository.getBookingReferences(booking.id, filter);

    return this.outputBookingReferencesService.getOutputBookingReferences(bookingReferences);
  }

  async getOrgBookingReferences(bookingUid: string, filter?: BookingReferencesFilterInput_2024_08_13) {
    const booking = await this.bookingsRepository.getByUidWithUser(bookingUid);

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

View on GitHub (pinned to 176037d0af)

Solutions

  1. Verify the booking UID via GET /v2/bookings/{uid} before requesting references.
  2. Confirm the correct environment.
  3. Ensure you are passing the booking UID, not a numeric booking ID or a reference UID.
Defensive patterns

Strategy: validation

Validate before calling

// Confirm the booking exists before fetching references.
const booking = await api.get(`/v2/bookings/${uid}`).catch((e) => (e.status === 404 ? null : Promise.reject(e)));
if (!booking) throw new Error(`Booking ${uid} not found`);

Try / catch

try {
  await api.get(`/v2/bookings/${uid}/references`);
} catch (err) {
  if (err.status === 404) {
    // booking missing: verify UID/environment
  }
  throw err;
}

Prevention

When it happens

Trigger: GET /v2/bookings/{uid}/references (or 2024-08-13 equivalent) with a UID that matches no booking.

Common situations: Wrong/typo UID; cross-environment UID; booking deleted; confusing a booking UID with a reference UID or booking ID.

Related errors


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