{"record":{"id":"1d973501a893d7fc","repo":"calcom/cal.diy","slug":"booking-with-uid-bookinguid-not-found-1d9735","errorCode":null,"errorMessage":"Booking with uid ${bookingUid} not found","messagePattern":"Booking with uid (.+?) not found","errorType":"exception","errorClass":"NotFoundException","httpStatus":404,"severity":"error","filePath":"apps/api/v2/src/platform/bookings/2024-08-13/services/booking-references.service.ts","lineNumber":23,"sourceCode":"import { Injectable, NotFoundException, BadRequestException } from \"@nestjs/common\";\n\n@Injectable()\nexport class BookingReferencesService_2024_08_13 {\n  constructor(\n    private readonly bookingsRepository: BookingsRepository_2024_08_13,\n    private readonly bookingReferencesRepository: BookingReferencesRepository_2024_08_13,\n    private readonly outputBookingReferencesService: OutputBookingReferencesService_2024_08_13\n  ) {}\n\n  async getBookingReferences(\n    bookingUid: string,\n    userId: number,\n    filter?: BookingReferencesFilterInput_2024_08_13\n  ) {\n    const booking = await this.bookingsRepository.getByUidWithUser(bookingUid);\n\n    if (!booking) {\n      throw new NotFoundException(`Booking with uid ${bookingUid} not found`);\n    }\n\n    if (booking.user?.id !== userId) {\n      throw new BadRequestException(`Booking with uid ${bookingUid} does not belong to user`);\n    }\n\n    const bookingReferences = await this.bookingReferencesRepository.getBookingReferences(booking.id, filter);\n\n    return this.outputBookingReferencesService.getOutputBookingReferences(bookingReferences);\n  }\n\n  async getOrgBookingReferences(bookingUid: string, filter?: BookingReferencesFilterInput_2024_08_13) {\n    const booking = await this.bookingsRepository.getByUidWithUser(bookingUid);\n\n    if (!booking) {\n      throw new NotFoundException(`Booking with uid ${bookingUid} not found`);\n    }\n","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/calcom/cal.diy/blob/176037d0afbe572f870a3c702985e7cd83fe6c0c/apps/api/v2/src/platform/bookings/2024-08-13/services/booking-references.service.ts#L5-L41","documentation":"Thrown in BookingReferencesService.getBookingReferences when getByUidWithUser returns no booking for the supplied UID. The booking-references GET endpoint first resolves the booking; a missing booking is HTTP 404 before any reference lookup.","triggerScenarios":"GET /v2/bookings/{uid}/references (or 2024-08-13 equivalent) with a UID that matches no booking.","commonSituations":"Wrong/typo UID; cross-environment UID; booking deleted; confusing a booking UID with a reference UID or booking ID.","solutions":["Verify the booking UID via GET /v2/bookings/{uid} before requesting references.","Confirm the correct environment.","Ensure you are passing the booking UID, not a numeric booking ID or a reference UID."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Confirm the booking exists before fetching references.\nconst booking = await api.get(`/v2/bookings/${uid}`).catch((e) => (e.status === 404 ? null : Promise.reject(e)));\nif (!booking) throw new Error(`Booking ${uid} not found`);","typeGuard":null,"tryCatchPattern":"try {\n  await api.get(`/v2/bookings/${uid}/references`);\n} catch (err) {\n  if (err.status === 404) {\n    // booking missing: verify UID/environment\n  }\n  throw err;\n}","preventionTips":["GET the booking before requesting its references.","Pass the booking UID, not a numeric ID or reference UID.","Confirm the target environment matches the UID's origin."],"tags":["booking","not-found","references"],"backgroundTag":null,"analyzedSha":"176037d0afbe572f870a3c702985e7cd83fe6c0c","analyzedAt":"2026-08-12T19:12:41.464Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}