calcom/cal.diy · error · NotFoundException

Booking with uid ${bookingUid} not found

Error message

Booking with uid ${bookingUid} not found

What it means

A 404 NotFoundException thrown by BookingGuestsService_2024_08_13.addGuests when bookingsRepository.getByUidWithAttendeesAndUserAndEvent(bookingUid) returns null. The guests endpoint needs a valid booking with attendees and user data to enforce the guest count limit and send notifications.

Source

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

import { addGuestsHandler } from "@calcom/platform-libraries/bookings";
import type { AddGuestsInput_2024_08_13 } from "@calcom/platform-types";

const MAX_TOTAL_GUESTS_PER_BOOKING = 30;

@Injectable()
export class BookingGuestsService_2024_08_13 {
  private readonly logger = new Logger("BookingGuestsService_2024_08_13");

  constructor(
    private readonly bookingsRepository: BookingsRepository_2024_08_13,
    private readonly bookingsService: BookingsService_2024_08_13,
    private readonly platformBookingsService: PlatformBookingsService
  ) {}

  async addGuests(bookingUid: string, input: AddGuestsInput_2024_08_13, user: ApiAuthGuardUser) {
    const booking = await this.bookingsRepository.getByUidWithAttendeesAndUserAndEvent(bookingUid);
    if (!booking) {
      throw new NotFoundException(`Booking with uid ${bookingUid} not found`);
    }

    const currentGuestCount = booking.attendees.length;
    const newGuestCount = input.guests.length;
    const totalGuestCount = currentGuestCount + newGuestCount;

    if (totalGuestCount > MAX_TOTAL_GUESTS_PER_BOOKING) {
      const remainingSlots = Math.max(0, MAX_TOTAL_GUESTS_PER_BOOKING - currentGuestCount);
      throw new BadRequestException(
        `Cannot add ${newGuestCount} guests. This booking already has ${currentGuestCount} attendees. ` +
          `Maximum total guests allowed is ${MAX_TOTAL_GUESTS_PER_BOOKING}. You can add up to ${remainingSlots} more guests.`
      );
    }

    const platformClientParams = booking.eventTypeId
      ? await this.platformBookingsService.getOAuthClientParams(booking.eventTypeId)
      : undefined;

View on GitHub (pinned to 176037d0af)

Solutions

  1. Verify the bookingUid exists via GET /v2/bookings/{bookingUid}.
  2. Use the booking UID (UUID-format string), not the numeric ID.
  3. Confirm the booking hasn't been cancelled — cancelled bookings may not support guest additions.
  4. Ensure you're targeting the correct API environment.
Defensive patterns

Strategy: validation

Validate before calling

// Verify the booking exists and check attendee count before adding guests
async function getBookingInfo(token, bookingUid) {
  const res = await fetch(`/v2/bookings/${bookingUid}/attendees`, {
    headers: { Authorization: `Bearer ${token}` }
  });
  if (!res.ok) return null;
  return res.json();
}

const booking = await getBookingInfo(token, bookingUid);
if (!booking) {
  throw new Error(`Booking ${bookingUid} not found — cannot add guests`);
}

Try / catch

try {
  await api.addGuests(bookingUid, guests);
} catch (err) {
  if (err.statusCode === 404 && err.message.includes('not found')) {
    console.error('Booking not found:', bookingUid);
  } else { throw err; }
}

Prevention

When it happens

Trigger: POST /v2/bookings/{bookingUid}/guests where bookingUid doesn't match any booking record. The repository method loads the booking with attendees, user, and event type relations to check guest limits (MAX_TOTAL_GUESTS_PER_BOOKING = 30) and platform email settings.

Common situations: Client sends a mistyped or stale bookingUid. The booking was cancelled or deleted before guests could be added. Using a numeric booking ID instead of the UID. Environment mismatch. The bookingUid was truncated or corrupted in transit.

Related errors


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