calcom/cal.diy · error · NotFoundException

No user found for booking with uid=${existingBooking.uid}

Error message

No user found for booking with uid=${existingBooking.uid}

What it means

A 404 NotFoundException thrown by BookingLocationIntegrationService_2024_08_13.handleIntegrationLocationUpdate when existingBookingHost is null. The existingBookingHost represents the booking's organizer user with their organizationId. If no user can be resolved as the host of the booking, the location update cannot proceed because integration credentials are resolved from the host user.

Source

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

  private readonly logger = new Logger("BookingLocationIntegrationService_2024_08_13");

  constructor(
    private readonly bookingsRepository: BookingsRepository_2024_08_13,
    private readonly bookingsService: BookingsService_2024_08_13,
    private readonly inputService: InputBookingsService_2024_08_13,
    private readonly bookingVideoService: BookingVideoService_2024_08_13,
    private readonly calendarSyncService: BookingLocationCalendarSyncService_2024_08_13,
    private readonly credentialService: BookingLocationCredentialService_2024_08_13
  ) {}

  async handleIntegrationLocationUpdate(
    existingBooking: BookingForLocationUpdate,
    inputLocation: { type: "integration"; integration: Integration_2024_08_13 },
    user: ApiAuthGuardUser,
    existingBookingHost: { organizationId: number | null } | null
  ): Promise<BookingLocationResponse> {
    if (!existingBookingHost) {
      throw new NotFoundException(`No user found for booking with uid=${existingBooking.uid}`);
    }

    const integrationSlug = inputLocation.integration;
    const internalLocation =
      apiToInternalintegrationsMapping[integrationSlug as keyof typeof apiToInternalintegrationsMapping];

    if (!internalLocation) {
      throw new BadRequestException(`Unsupported integration: ${integrationSlug}`);
    }

    const booking = await this.bookingsRepository.getBookingByIdWithUserAndEventDetails(existingBooking.id);
    if (!bookingHasUser(booking)) {
      throw new NotFoundException(`Could not load booking details for uid=${existingBooking.uid}`);
    }

    const ctx: IntegrationHandlerContext = {
      existingBooking,
      booking,

View on GitHub (pinned to 176037d0af)

Solutions

  1. Verify the booking has a valid organizer by calling GET /v2/bookings/{bookingUid} and checking the user field.
  2. If the organizer was deleted, reassign the booking to an active user via database administration or the Cal.com dashboard.
  3. If this is a team booking with no assigned host, assign a host to the booking first.
  4. For data integrity issues, run a database audit to find bookings with null or orphaned userId values.
Defensive patterns

Strategy: validation

Validate before calling

// Verify the booking has a valid host before updating location
async function bookingHasValidHost(token, bookingUid) {
  const res = await fetch(`/v2/bookings/${bookingUid}`, {
    headers: { Authorization: `Bearer ${token}` }
  });
  if (!res.ok) return false;
  const { data } = await res.json();
  return !!(data.user && data.user.id); // host user must exist
}

if (!(await bookingHasValidHost(token, bookingUid))) {
  throw new Error('Booking has no valid host user — cannot update integration location');
}

Try / catch

try {
  await api.updateBookingLocation(bookingUid, { type: 'integration', integration: 'zoom' });
} catch (err) {
  if (err.statusCode === 404 && err.message.includes('No user found for booking')) {
    // The booking's organizer was deleted — reassign or use a different booking
    throw new Error('Booking organizer account is missing — contact support to reassign');
  }
  throw err;
}

Prevention

When it happens

Trigger: PATCH /v2/bookings/{bookingUid}/location with location type 'integration' where the booking's host user record is null — the booking.userId points to a user that was deleted, the booking has no assigned user (userId is null), or the repository query that resolves the host returned no result.

Common situations: The booking organizer's user account was deleted but their bookings remain. The booking was created by a system process without a valid userId. A data migration left orphaned bookings with stale user references. The booking belongs to a team event type where the assigned host was removed from the team.

Related errors


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