{"record":{"id":"1c3328bbbccd17fe","repo":"calcom/cal.diy","slug":"booking-with-uid-uid-was-not-found-in-the-datab","errorCode":null,"errorMessage":"Booking with uid=${uid} was not found in the database","messagePattern":"Booking with uid=(.+?) was not found in the database","errorType":"exception","errorClass":"NotFoundException","httpStatus":404,"severity":"error","filePath":"apps/api/v2/src/platform/bookings/2024-08-13/services/bookings.service.ts","lineNumber":581,"sourceCode":"      const isSeated = !!booking.eventType?.seatsPerTimeSlot;\n\n      if (isRecurring && !isSeated) {\n        return this.outputService.getOutputRecurringBooking(booking);\n      }\n      if (isRecurring && isSeated) {\n        const showAttendees = userIsEventTypeAdminOrOwner || !!booking.eventType?.seatsShowAttendees;\n        return this.outputService.getOutputRecurringSeatedBooking(booking, showAttendees);\n      }\n      if (isSeated) {\n        const showAttendees = userIsEventTypeAdminOrOwner || !!booking.eventType?.seatsShowAttendees;\n        return this.outputService.getOutputSeatedBooking(booking, showAttendees);\n      }\n      return this.outputService.getOutputBooking(booking);\n    }\n\n    const recurringBooking = await this.bookingsRepository.getRecurringByUidWithAttendeesAndUserAndEvent(uid);\n    if (!recurringBooking.length) {\n      throw new NotFoundException(`Booking with uid=${uid} was not found in the database`);\n    }\n    const ids = recurringBooking.map((booking) => booking.id);\n    const isRecurringSeated = !!recurringBooking[0].eventType?.seatsPerTimeSlot;\n    if (isRecurringSeated) {\n      const showAttendees =\n        userIsEventTypeAdminOrOwner || !!recurringBooking[0].eventType?.seatsShowAttendees;\n      return this.outputService.getOutputRecurringSeatedBookings(ids, showAttendees);\n    }\n\n    return this.outputService.getOutputRecurringBookings(ids);\n  }\n\n  async getBookingBySeatUid(seatUid: string, authUser: AuthOptionalUser) {\n    const bookingSeat =\n      await this.bookingSeatRepository.getByReferenceUidIncludeBookingWithAttendeesAndUserAndEvent(seatUid);\n\n    if (!bookingSeat || !bookingSeat.booking) {\n      throw new NotFoundException(`Booking with seatUid=${seatUid} was not found in the database`);","sourceCodeStart":563,"sourceCodeEnd":599,"githubUrl":"https://github.com/calcom/cal.diy/blob/176037d0afbe572f870a3c702985e7cd83fe6c0c/apps/api/v2/src/platform/bookings/2024-08-13/services/bookings.service.ts#L563-L599","documentation":"Thrown by getBooking when the requested uid is not found as a single booking and the fallback recurring booking lookup (getRecurringByUidWithAttendeesAndUserAndEvent) returns an empty array. The service raises NotFoundException (HTTP 404) naming the uid.","triggerScenarios":"A GET /v2/bookings/:uid request where uid does not match any booking or recurring booking root in the database — typo, deleted booking, wrong environment.","commonSituations":"Using a booking UID from staging in production; booking was cancelled and purged; uid truncated or copied with extra characters; calling before the booking was committed.","solutions":["Verify the uid is a complete, valid booking UID (format: ULID-like string).","Confirm you are hitting the same Cal.com environment/instance where the booking was created.","If the booking may have been cancelled, list bookings via GET /v2/bookings to locate the current uid."],"exampleFix":"// before\nconst res = await client.get(`/v2/bookings/${shortUid}`);\n// after — use the full uid returned at creation time\nconst { uid } = await client.post('/v2/bookings', body);\nconst res = await client.get(`/v2/bookings/${uid}`);","handlingStrategy":"try-catch","validationCode":"if (!/^[a-z0-9]+$/i.test(uid) || uid.length < 10) throw new Error('Invalid booking uid format');","typeGuard":"function isLikelyBookingUid(uid: string): boolean {\n  return typeof uid === 'string' && uid.length >= 16;\n}","tryCatchPattern":"try { return await client.get(`/v2/bookings/${uid}`); }\ncatch (e) {\n  if (e.status === 404 && /Booking with uid/.test(e.message)) return null;\n  throw e;\n}","preventionTips":["Store the uid returned at creation time","Do not truncate or transform uids","Validate uid format before sending"],"tags":["api-v2","bookings","not-found","uid"],"backgroundTag":null,"analyzedSha":"176037d0afbe572f870a3c702985e7cd83fe6c0c","analyzedAt":"2026-08-12T19:12:41.464Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}