calcom/cal.diy · error · NotFoundException

Booking with uid=${uid} was not found in the database

Error message

Booking with uid=${uid} was not found in the database

What it means

Thrown by getBooking when the requested uid is not found as a single booking and the fallback recurring booking lookup (getRecurringByUidWithAttendeesAndUserAndEvent) returns an empty array. The service raises NotFoundException (HTTP 404) naming the uid.

Source

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

      const isSeated = !!booking.eventType?.seatsPerTimeSlot;

      if (isRecurring && !isSeated) {
        return this.outputService.getOutputRecurringBooking(booking);
      }
      if (isRecurring && isSeated) {
        const showAttendees = userIsEventTypeAdminOrOwner || !!booking.eventType?.seatsShowAttendees;
        return this.outputService.getOutputRecurringSeatedBooking(booking, showAttendees);
      }
      if (isSeated) {
        const showAttendees = userIsEventTypeAdminOrOwner || !!booking.eventType?.seatsShowAttendees;
        return this.outputService.getOutputSeatedBooking(booking, showAttendees);
      }
      return this.outputService.getOutputBooking(booking);
    }

    const recurringBooking = await this.bookingsRepository.getRecurringByUidWithAttendeesAndUserAndEvent(uid);
    if (!recurringBooking.length) {
      throw new NotFoundException(`Booking with uid=${uid} was not found in the database`);
    }
    const ids = recurringBooking.map((booking) => booking.id);
    const isRecurringSeated = !!recurringBooking[0].eventType?.seatsPerTimeSlot;
    if (isRecurringSeated) {
      const showAttendees =
        userIsEventTypeAdminOrOwner || !!recurringBooking[0].eventType?.seatsShowAttendees;
      return this.outputService.getOutputRecurringSeatedBookings(ids, showAttendees);
    }

    return this.outputService.getOutputRecurringBookings(ids);
  }

  async getBookingBySeatUid(seatUid: string, authUser: AuthOptionalUser) {
    const bookingSeat =
      await this.bookingSeatRepository.getByReferenceUidIncludeBookingWithAttendeesAndUserAndEvent(seatUid);

    if (!bookingSeat || !bookingSeat.booking) {
      throw new NotFoundException(`Booking with seatUid=${seatUid} was not found in the database`);

View on GitHub (pinned to 176037d0af)

Solutions

  1. Verify the uid is a complete, valid booking UID (format: ULID-like string).
  2. Confirm you are hitting the same Cal.com environment/instance where the booking was created.
  3. If the booking may have been cancelled, list bookings via GET /v2/bookings to locate the current uid.

Example fix

// before
const res = await client.get(`/v2/bookings/${shortUid}`);
// after — use the full uid returned at creation time
const { uid } = await client.post('/v2/bookings', body);
const res = await client.get(`/v2/bookings/${uid}`);
Defensive patterns

Strategy: try-catch

Validate before calling

if (!/^[a-z0-9]+$/i.test(uid) || uid.length < 10) throw new Error('Invalid booking uid format');

Type guard

function isLikelyBookingUid(uid: string): boolean {
  return typeof uid === 'string' && uid.length >= 16;
}

Try / catch

try { return await client.get(`/v2/bookings/${uid}`); }
catch (e) {
  if (e.status === 404 && /Booking with uid/.test(e.message)) return null;
  throw e;
}

Prevention

When it happens

Trigger: A GET /v2/bookings/:uid request where uid does not match any booking or recurring booking root in the database — typo, deleted booking, wrong environment.

Common situations: Using a booking UID from staging in production; booking was cancelled and purged; uid truncated or copied with extra characters; calling before the booking was committed.

Related errors


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