calcom/cal.diy · warning · BadRequestException

Cannot add ${newGuestCount} guests. This booking already has

Error message

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.

What it means

A 400 BadRequestException thrown by BookingGuestsService_2024_08_13.addGuests when the sum of existing attendees plus new guests exceeds MAX_TOTAL_GUESTS_PER_BOOKING (hardcoded at 30). The error message includes the current count, requested count, the limit, and remaining slots to help the client adjust.

Source

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

  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;

    const emailsEnabled = platformClientParams ? platformClientParams.arePlatformEmailsEnabled : true;

    const res = await addGuestsHandler({
      ctx: { user },
      input: { bookingId: booking.id, guests: input.guests },
      emailsEnabled,
      actionSource: "API_V2",
    });
    if (res.message === "Guests added") {

View on GitHub (pinned to 176037d0af)

Solutions

  1. Read the error message — it tells you exactly how many guests you can still add (remainingSlots).
  2. Reduce the number of guests in the request to fit within the remaining slots.
  3. If you need more than 30 total attendees, consider using a different event type (e.g., a seated/routed event type) or contact Cal.com support about platform limits.
  4. Call GET /v2/bookings/{bookingUid}/attendees first to check the current count before adding guests.

Example fix

// before — trying to add 5 guests to a booking with 28 attendees
POST /v2/bookings/abc-123/guests
{ "guests": ["a@x.com", "b@x.com", "c@x.com", "d@x.com", "e@x.com"] }
// -> 400: Cannot add 5 guests. Already has 28. Max 30. Add up to 2 more.

// after — add only 2 guests to stay within the limit
POST /v2/bookings/abc-123/guests
{ "guests": ["a@x.com", "b@x.com"] }
Defensive patterns

Strategy: validation

Validate before calling

// Check attendee count before adding guests to avoid exceeding the 30 limit
const MAX_TOTAL_GUESTS_PER_BOOKING = 30;

async function canAddGuests(token, bookingUid, guestCount) {
  const res = await fetch(`/v2/bookings/${bookingUid}/attendees`, {
    headers: { Authorization: `Bearer ${token}` }
  });
  if (!res.ok) return false;
  const { data } = await res.json();
  const currentCount = data.length;
  const remaining = MAX_TOTAL_GUESTS_PER_BOOKING - currentCount;
  return { canAdd: guestCount <= remaining, remaining };
}

const { canAdd, remaining } = await canAddGuests(token, bookingUid, guests.length);
if (!canAdd) {
  throw new Error(`Cannot add ${guests.length} guests — only ${remaining} slots remaining`);
}

Try / catch

try {
  await api.addGuests(bookingUid, guests);
} catch (err) {
  if (err.statusCode === 400 && err.message.includes('Maximum total guests')) {
    // Parse remaining slots from the error message and add in batches
    const remaining = parseRemainingSlots(err.message);
    const batch = guests.slice(0, remaining);
    if (batch.length > 0) await api.addGuests(bookingUid, batch);
  } else { throw err; }
}

Prevention

When it happens

Trigger: POST /v2/bookings/{bookingUid}/guests with a guests array whose length, when added to the booking's existing attendees count (booking.attendees.length), exceeds 30. For example, a booking with 28 attendees where the client tries to add 3 more guests (28 + 3 = 31 > 30).

Common situations: Large group bookings where the organizer invites many guests. Automated systems bulk-adding guests without checking the limit first. A booking that already has many attendees from prior guest additions. Event types designed for large groups but hitting the platform-wide 30-guest cap.

Related errors


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