{"record":{"id":"33cb2ed5498fd73d","repo":"calcom/cal.diy","slug":"booking-with-uid-bookinguid-not-found-33cb2e","errorCode":null,"errorMessage":"Booking with uid ${bookingUid} not found","messagePattern":"Booking with uid (.+?) not found","errorType":"http","errorClass":"NotFoundException","httpStatus":404,"severity":"error","filePath":"apps/api/v2/src/platform/bookings/2024-08-13/services/booking-guests.service.ts","lineNumber":25,"sourceCode":"import { addGuestsHandler } from \"@calcom/platform-libraries/bookings\";\nimport type { AddGuestsInput_2024_08_13 } from \"@calcom/platform-types\";\n\nconst MAX_TOTAL_GUESTS_PER_BOOKING = 30;\n\n@Injectable()\nexport class BookingGuestsService_2024_08_13 {\n  private readonly logger = new Logger(\"BookingGuestsService_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 platformBookingsService: PlatformBookingsService\n  ) {}\n\n  async addGuests(bookingUid: string, input: AddGuestsInput_2024_08_13, user: ApiAuthGuardUser) {\n    const booking = await this.bookingsRepository.getByUidWithAttendeesAndUserAndEvent(bookingUid);\n    if (!booking) {\n      throw new NotFoundException(`Booking with uid ${bookingUid} not found`);\n    }\n\n    const currentGuestCount = booking.attendees.length;\n    const newGuestCount = input.guests.length;\n    const totalGuestCount = currentGuestCount + newGuestCount;\n\n    if (totalGuestCount > MAX_TOTAL_GUESTS_PER_BOOKING) {\n      const remainingSlots = Math.max(0, MAX_TOTAL_GUESTS_PER_BOOKING - currentGuestCount);\n      throw new BadRequestException(\n        `Cannot add ${newGuestCount} guests. This booking already has ${currentGuestCount} attendees. ` +\n          `Maximum total guests allowed is ${MAX_TOTAL_GUESTS_PER_BOOKING}. You can add up to ${remainingSlots} more guests.`\n      );\n    }\n\n    const platformClientParams = booking.eventTypeId\n      ? await this.platformBookingsService.getOAuthClientParams(booking.eventTypeId)\n      : undefined;\n","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/calcom/cal.diy/blob/176037d0afbe572f870a3c702985e7cd83fe6c0c/apps/api/v2/src/platform/bookings/2024-08-13/services/booking-guests.service.ts#L7-L43","documentation":"A 404 NotFoundException thrown by BookingGuestsService_2024_08_13.addGuests when bookingsRepository.getByUidWithAttendeesAndUserAndEvent(bookingUid) returns null. The guests endpoint needs a valid booking with attendees and user data to enforce the guest count limit and send notifications.","triggerScenarios":"POST /v2/bookings/{bookingUid}/guests where bookingUid doesn't match any booking record. The repository method loads the booking with attendees, user, and event type relations to check guest limits (MAX_TOTAL_GUESTS_PER_BOOKING = 30) and platform email settings.","commonSituations":"Client sends a mistyped or stale bookingUid. The booking was cancelled or deleted before guests could be added. Using a numeric booking ID instead of the UID. Environment mismatch. The bookingUid was truncated or corrupted in transit.","solutions":["Verify the bookingUid exists via GET /v2/bookings/{bookingUid}.","Use the booking UID (UUID-format string), not the numeric ID.","Confirm the booking hasn't been cancelled — cancelled bookings may not support guest additions.","Ensure you're targeting the correct API environment."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Verify the booking exists and check attendee count before adding guests\nasync function getBookingInfo(token, bookingUid) {\n  const res = await fetch(`/v2/bookings/${bookingUid}/attendees`, {\n    headers: { Authorization: `Bearer ${token}` }\n  });\n  if (!res.ok) return null;\n  return res.json();\n}\n\nconst booking = await getBookingInfo(token, bookingUid);\nif (!booking) {\n  throw new Error(`Booking ${bookingUid} not found — cannot add guests`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await api.addGuests(bookingUid, guests);\n} catch (err) {\n  if (err.statusCode === 404 && err.message.includes('not found')) {\n    console.error('Booking not found:', bookingUid);\n  } else { throw err; }\n}","preventionTips":["Verify the booking UID exists before adding guests.","Use booking UIDs, not numeric IDs.","Confirm the booking hasn't been cancelled — cancelled bookings reject guest additions.","Store booking UIDs from creation and reference them consistently."],"tags":["not-found","booking","guests","validation","nestjs"],"backgroundTag":null,"analyzedSha":"176037d0afbe572f870a3c702985e7cd83fe6c0c","analyzedAt":"2026-08-12T19:12:41.464Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}