{"record":{"id":"e8ee7840e01aa6df","repo":"calcom/cal.diy","slug":"no-user-found-for-booking-with-uid-existingbooki","errorCode":null,"errorMessage":"No user found for booking with uid=${existingBooking.uid}","messagePattern":"No user found for booking with uid=(.+?)","errorType":"http","errorClass":"NotFoundException","httpStatus":404,"severity":"error","filePath":"apps/api/v2/src/platform/bookings/2024-08-13/services/booking-location-integration.service.ts","lineNumber":73,"sourceCode":"  private readonly logger = new Logger(\"BookingLocationIntegrationService_2024_08_13\");\n\n  constructor(\n    private readonly bookingsRepository: BookingsRepository_2024_08_13,\n    private readonly bookingsService: BookingsService_2024_08_13,\n    private readonly inputService: InputBookingsService_2024_08_13,\n    private readonly bookingVideoService: BookingVideoService_2024_08_13,\n    private readonly calendarSyncService: BookingLocationCalendarSyncService_2024_08_13,\n    private readonly credentialService: BookingLocationCredentialService_2024_08_13\n  ) {}\n\n  async handleIntegrationLocationUpdate(\n    existingBooking: BookingForLocationUpdate,\n    inputLocation: { type: \"integration\"; integration: Integration_2024_08_13 },\n    user: ApiAuthGuardUser,\n    existingBookingHost: { organizationId: number | null } | null\n  ): Promise<BookingLocationResponse> {\n    if (!existingBookingHost) {\n      throw new NotFoundException(`No user found for booking with uid=${existingBooking.uid}`);\n    }\n\n    const integrationSlug = inputLocation.integration;\n    const internalLocation =\n      apiToInternalintegrationsMapping[integrationSlug as keyof typeof apiToInternalintegrationsMapping];\n\n    if (!internalLocation) {\n      throw new BadRequestException(`Unsupported integration: ${integrationSlug}`);\n    }\n\n    const booking = await this.bookingsRepository.getBookingByIdWithUserAndEventDetails(existingBooking.id);\n    if (!bookingHasUser(booking)) {\n      throw new NotFoundException(`Could not load booking details for uid=${existingBooking.uid}`);\n    }\n\n    const ctx: IntegrationHandlerContext = {\n      existingBooking,\n      booking,","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/calcom/cal.diy/blob/176037d0afbe572f870a3c702985e7cd83fe6c0c/apps/api/v2/src/platform/bookings/2024-08-13/services/booking-location-integration.service.ts#L55-L91","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the booking has a valid organizer by calling GET /v2/bookings/{bookingUid} and checking the user field.","If the organizer was deleted, reassign the booking to an active user via database administration or the Cal.com dashboard.","If this is a team booking with no assigned host, assign a host to the booking first.","For data integrity issues, run a database audit to find bookings with null or orphaned userId values."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Verify the booking has a valid host before updating location\nasync function bookingHasValidHost(token, bookingUid) {\n  const res = await fetch(`/v2/bookings/${bookingUid}`, {\n    headers: { Authorization: `Bearer ${token}` }\n  });\n  if (!res.ok) return false;\n  const { data } = await res.json();\n  return !!(data.user && data.user.id); // host user must exist\n}\n\nif (!(await bookingHasValidHost(token, bookingUid))) {\n  throw new Error('Booking has no valid host user — cannot update integration location');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await api.updateBookingLocation(bookingUid, { type: 'integration', integration: 'zoom' });\n} catch (err) {\n  if (err.statusCode === 404 && err.message.includes('No user found for booking')) {\n    // The booking's organizer was deleted — reassign or use a different booking\n    throw new Error('Booking organizer account is missing — contact support to reassign');\n  }\n  throw err;\n}","preventionTips":["Verify the booking's organizer user still exists before updating integration locations.","When deleting users, reassign their bookings to active users first.","Run periodic data integrity checks for bookings with null or orphaned userId values.","For team bookings, ensure at least one host is always assigned."],"tags":["not-found","booking","location","integration","host","data-integrity","nestjs"],"backgroundTag":null,"analyzedSha":"176037d0afbe572f870a3c702985e7cd83fe6c0c","analyzedAt":"2026-08-12T19:12:41.464Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}