{"record":{"id":"de482f63367e18a9","repo":"calcom/cal.diy","slug":"booking-with-uid-bookinguid-was-not-found-in-th","errorCode":null,"errorMessage":"Booking with uid=${bookingUid} 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":851,"sourceCode":"    }\n    if (booking.status === \"CANCELLED\" && booking.rescheduled) {\n      const rescheduledTo = await this.bookingsRepository.getByFromReschedule(bookingUid);\n      throw new BadRequestException(\n        `Can't reschedule booking with uid=${bookingUid} because it has been cancelled and rescheduled already to booking with uid=${rescheduledTo?.uid}. You probably want to reschedule ${rescheduledTo?.uid} instead by passing it within the request URL.`\n      );\n    }\n    return booking;\n  }\n\n  async shouldRescheduleIndividualSeat(\n    bookingUid: string,\n    isIndividualSeatReschedule: boolean,\n    authUser: AuthOptionalUser\n  ) {\n    const booking = await this.bookingsRepository.getByUidWithUserIdAndSeatsReferencesCount(bookingUid);\n\n    if (!booking) {\n      throw new NotFoundException(`Booking with uid=${bookingUid} was not found in the database`);\n    }\n\n    const hasSeatsPresent = booking.seatsReferences.length > 0;\n\n    if (!hasSeatsPresent) return false;\n\n    return await this.isIndividualSeatOrOrgAdminReschedule(\n      isIndividualSeatReschedule,\n      booking.userId,\n      authUser?.id\n    );\n  }\n\n  async isIndividualSeatOrOrgAdminReschedule(\n    isIndividualSeatReschedule: boolean,\n    bookingUserId: number | null,\n    authUserId?: number | null\n  ) {","sourceCodeStart":833,"sourceCodeEnd":869,"githubUrl":"https://github.com/calcom/cal.diy/blob/176037d0afbe572f870a3c702985e7cd83fe6c0c/apps/api/v2/src/platform/bookings/2024-08-13/services/bookings.service.ts#L833-L869","documentation":"Thrown by shouldRescheduleIndividualSeat when getByUidWithUserIdAndSeatsReferencesCount returns null for the provided bookingUid. This guard runs during reschedule routing to decide whether a seat-level reschedule applies. NotFoundException (HTTP 404).","triggerScenarios":"A reschedule request whose bookingUid does not exist in the database when the service checks for seat references and ownership routing.","commonSituations":"Typo in uid; booking deleted; using a seatUid where a bookingUid is expected; environment mismatch.","solutions":["Validate the bookingUid format and existence via GET /v2/bookings/:uid before rescheduling.","Ensure the correct uid (booking, not seat) is passed to the reschedule endpoint.","Use the uid returned by the original booking creation response."],"exampleFix":"// before\nawait client.post(`/v2/bookings/${maybeSeatUid}/reschedule`, body);\n// after\nconst booking = await client.get(`/v2/bookings/${uid}`);\nawait client.post(`/v2/bookings/${booking.uid}/reschedule`, body);","handlingStrategy":"validation","validationCode":"const b = await client.get(`/v2/bookings/${uid}`);\nif (!b) throw new Error('Booking not found; cannot reschedule');","typeGuard":"function isExistingBooking<T>(b: T | null): b is T { return b !== null; }","tryCatchPattern":"try { await client.post(`/v2/bookings/${uid}/reschedule`, body); }\ncatch (e) {\n  if (e.status === 404 && /not found in the database/.test(e.message)) { /* surface 'booking missing' to user */ }\n  else throw e;\n}","preventionTips":["Verify uid existence before reschedule","Pass the booking uid, not seat uid","Use uids from creation/listing responses"],"tags":["api-v2","bookings","reschedule","not-found","uid"],"backgroundTag":null,"analyzedSha":"176037d0afbe572f870a3c702985e7cd83fe6c0c","analyzedAt":"2026-08-12T19:12:41.464Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}