calcom/cal.diy · error · NotFoundException

Booking with uid=${bookingUid} not found

Error message

Booking with uid=${bookingUid} not found

What it means

Top-level guard in BookingLocationService.updateBookingLocation. The booking UID supplied to the PATCH location endpoint does not resolve via getBookingByUidWithUserAndEventDetails — the row does not exist. This is a straightforward HTTP 404 at the entry point of the location update flow.

Source

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

    private readonly bookingsRepository: BookingsRepository_2024_08_13,
    private readonly bookingsService: BookingsService_2024_08_13,
    private readonly usersRepository: UsersRepository,
    private readonly inputService: InputBookingsService_2024_08_13,
    private readonly eventTypesRepository: EventTypesRepository_2024_06_14,
    private readonly eventTypeAccessService: EventTypeAccessService,
    private readonly bookingVideoService: BookingVideoService_2024_08_13,
    private readonly integrationService: BookingLocationIntegrationService_2024_08_13,
    private readonly calendarSyncService: BookingLocationCalendarSyncService_2024_08_13
  ) {}

  async updateBookingLocation(
    bookingUid: string,
    input: UpdateBookingLocationInput_2024_08_13,
    user: ApiAuthGuardUser
  ): Promise<BookingLocationResponse> {
    const existingBooking = await this.bookingsRepository.getBookingByUidWithUserAndEventDetails(bookingUid);
    if (!existingBooking) {
      throw new NotFoundException(`Booking with uid=${bookingUid} not found`);
    }

    if (existingBooking.eventTypeId && existingBooking.eventType) {
      const eventType = await this.eventTypesRepository.getEventTypeByIdWithOwnerAndTeam(
        existingBooking.eventTypeId
      );
      if (eventType) {
        const isAllowed = await this.eventTypeAccessService.userIsEventTypeAdminOrOwner(user, eventType);
        if (!isAllowed) {
          throw new ForbiddenException(
            "User is not authorized to update this booking location. User must be the event type owner, host, team admin or owner, or org admin or owner."
          );
        }
      }
    }

    const { location } = input;

View on GitHub (pinned to 176037d0af)

Solutions

  1. Verify the UID with GET /v2/bookings/{uid} before PATCHing.
  2. Confirm you are targeting the correct environment (same DB the UID was issued from).
  3. If the booking was deleted/cancelled, obtain the correct active booking UID.

Example fix

// before: PATCH /v2/bookings/abc...notreal/location
// after
const exists = await api.get(`/v2/bookings/${uid}`).catch(() => null);
if (!exists) throw new Error(`Booking ${uid} does not exist in this environment`);
await api.patch(`/v2/bookings/${uid}/location`, payload);
Defensive patterns

Strategy: validation

Validate before calling

// Confirm the booking exists before PATCHing its location.
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 in this environment`);

Type guard

function isExistingUid(uid: string): boolean {
  return typeof uid === 'string' && uid.trim().length > 0;
}

Try / catch

try {
  await api.patch(`/v2/bookings/${uid}/location`, payload);
} catch (err) {
  if (err.status === 404) {
    // booking missing: verify environment / UID, or skip
  }
  throw err;
}

Prevention

When it happens

Trigger: PATCH /v2/bookings/{uid} (or 2024-08-13 location endpoint) with a UID that no booking row matches.

Common situations: Typo or truncation in the UID; using a staging UID against production (or vice versa); booking already cancelled/deleted; copy/paste of a recurring-series parent UID instead of an individual booking UID.

Related errors


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