calcom/cal.diy · error · BadRequestException

User either already has booking at this time or is not avail

Error message

User either already has booking at this time or is not available

What it means

Thrown by handleBookingError when the booking engine raised 'no_available_users_found_error' and bookingTeamEventType is false. BadRequestException (HTTP 400). The single-user variant of error 326: the organizer already has a booking at that time or is outside their working hours.

Source

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

      );
    }
    if (body.teamSlug && body.eventTypeSlug && body.organizationSlug) {
      throw new NotFoundException(
        `Event type with slug ${body.eventTypeSlug} belonging to team ${body.teamSlug} within organization ${body.organizationSlug} not found.`
      );
    }
    throw new NotFoundException(`Event type with id ${body.eventTypeId} not found.`);
  }

  handleBookingError(error: unknown, bookingTeamEventType: boolean): never {
    const hostsUnavaile = "One of the hosts either already has booking at this time or is not available";

    if (error instanceof Error) {
      if (error.message === "no_available_users_found_error") {
        if (bookingTeamEventType) {
          throw new BadRequestException(hostsUnavaile);
        }
        throw new BadRequestException("User either already has booking at this time or is not available");
      } else if (error.message === "booking_time_out_of_bounds_error") {
        throw new BadRequestException(
          `The event type can't be booked at the "start" time provided. This could be because it's too soon (violating the minimum booking notice) or too far in the future (outside the event's scheduling window). Try fetching available slots first using the GET /v2/slots endpoint and then make a booking with "start" time equal to one of the available slots.`
        );
      } else if (error.message === "Attempting to book a meeting in the past.") {
        throw new BadRequestException("Attempting to book a meeting in the past.");
      } else if (error.message === "hosts_unavailable_for_booking") {
        throw new BadRequestException(hostsUnavaile);
      } else if (error.message === "booker_limit_exceeded_error") {
        throw new BadRequestException(
          "Attendee with this email can't book because the maximum number of active bookings has been reached."
        );
      } else if (error.message === "booker_limit_exceeded_error_reschedule") {
        const errorData =
          "data" in error ? (error.data as { rescheduleUid: string }) : { rescheduleUid: undefined };
        let message =
          "Attendee with this email can't book because the maximum number of active bookings has been reached.";
        if (errorData?.rescheduleUid) {

View on GitHub (pinned to 176037d0af)

Solutions

  1. Pre-fetch available slots via GET /v2/slots and POST a start time returned by it.
  2. Verify the attendee's timezone matches the slot timezone to avoid off-by-one double bookings.
  3. Retry with the next available slot rather than the rejected one.
  4. Reduce booking buffer overlap by adjusting event-type buffers if the pattern recurs.

Example fix

// before
start = '2026-08-12T15:00:00Z'  // owner busy

// after
const slots = await api.get(`/v2/slots?eventTypeId=${eventTypeId}&startTime=2026-08-12T00:00:00Z&endTime=2026-08-13T00:00:00Z`);
start = slots.data.slots.find(s => s.start !== rejectedStart).start;
Defensive patterns

Strategy: validation

Validate before calling

const slots = await api.get(`/v2/slots?eventTypeId=${eventTypeId}&startTime=${from}&endTime=${to}`);
const ok = slots.data.slots.some(s => s.start === body.start);
if (!ok) throw new Error('owner not available at requested start');

Type guard

null

Try / catch

try { await api.post('/v2/bookings', body); }
catch (e) {
  if (e.response?.status === 400 && /User either already has booking/.test(e.response.data.message)) {
    body.start = (await api.get(`/v2/slots?eventTypeId=${body.eventTypeId}&...`)).data.slots[0].start;
    await api.post('/v2/bookings', body);
  } else throw e;
}

Prevention

When it happens

Trigger: Booking a user (non-team) event type at a start time where the owner already has a booking, has blocked their calendar, is outside working hours, or has a conflicting buffer. The engine returns no_available_users_found_error and the service maps it to this single-user message.

Common situations: Double-booking the same slot from two clients; booking outside the user's set working hours; overlapping buffers; user manually blocked the slot in their calendar; timezone math error producing a slot inside a busy period.

Related errors


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