{"record":{"id":"f3edfffe645e213b","repo":"calcom/cal.diy","slug":"booking-with-uid-bookinguid-was-not-found-in-th-f3edff","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/cal-video.service.ts","lineNumber":31,"sourceCode":"@Injectable()\nexport class CalVideoService {\n  private readonly logger = new Logger(\"CalVideoService\");\n  constructor(\n    private readonly bookingsRepository: BookingsRepository_2024_08_13,\n    private readonly calVideoOutputService: CalVideoOutputService\n  ) {}\n\n  private getVideoSessionsRoomName(references?: Array<{ type: string; meetingId?: string | null }>) {\n    return (\n      references?.filter((reference) => reference.type === CAL_VIDEO_TYPE)?.pop()?.meetingId ??\n      undefined\n    );\n  }\n\n  async getRecordings(bookingUid: string) {\n    const booking = await this.bookingsRepository.getByUidWithBookingReference(bookingUid);\n    if (!booking) {\n      throw new NotFoundException(`Booking with uid=${bookingUid} was not found in the database`);\n    }\n\n    const roomName = this.getVideoSessionsRoomName(booking.references);\n    if (!roomName) {\n      throw new NotFoundException(`No Cal Video reference found with booking uid ${bookingUid}`);\n    }\n\n    const recordings = await getRecordingsOfCalVideoByRoomName(roomName);\n\n    if (!recordings || !(\"data\" in recordings)) return [];\n\n    const recordingWithDownloadLink = recordings.data.map((recording) => {\n      return getDownloadLinkOfCalVideoByRecordingId(recording.id)\n        .then((res: { download_link: string } | undefined) => ({\n          id: recording.id,\n          roomName: recording.room_name,\n          startTs: recording.start_ts,\n          status: recording.status,","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/calcom/cal.diy/blob/176037d0afbe572f870a3c702985e7cd83fe6c0c/apps/api/v2/src/platform/bookings/2024-08-13/services/cal-video.service.ts#L13-L49","documentation":"Thrown by CalVideoService.getRecordings when getByUidWithBookingReference(bookingUid) returns null. NestJS NotFoundException (HTTP 404). The booking uid passed to the recordings endpoint does not exist, so recordings cannot be looked up.","triggerScenarios":"GET /v2/bookings/{uid}/recordings with a non-existent bookingUid; booking deleted before the call; uid from the wrong environment.","commonSituations":"Polling for recordings on a booking that was cancelled/removed; stale uid in client state; copy errors.","solutions":["Verify the booking with GET /v2/bookings/{uid} before requesting recordings.","Stop polling once a booking returns 404.","Confirm the uid and environment.","Treat 404 as terminal in recording-fetch workflows."],"exampleFix":"// before\nconst recs = await apiClient.get(`/v2/bookings/${uid}/recordings`);\n\n// after\nconst booking = await apiClient.get(`/v2/bookings/${uid}`).then(r => r.data).catch(() => null);\nif (!booking) return []; // booking gone - no recordings\nconst recs = await apiClient.get(`/v2/bookings/${uid}/recordings`);","handlingStrategy":"validation","validationCode":"const booking = await apiClient.get(`/v2/bookings/${uid}`).then(r => r.data).catch(() => null);\nif (!booking) { console.warn(`Booking ${uid} missing - no recordings`); return []; }","typeGuard":"function isBookingMissing(err: unknown): boolean {\n  return typeof err === 'object' && err !== null &&\n    (err as any).response?.status === 404 &&\n    /was not found in the database/i.test((err as any).response?.data?.message ?? '');\n}","tryCatchPattern":"try {\n  return await apiClient.get(`/v2/bookings/${uid}/recordings`).then(r => r.data);\n} catch (err) {\n  if (err.response?.status === 404 && /was not found in the database/i.test(err.response?.data?.message ?? '')) return [];\n  throw err;\n}","preventionTips":["Verify the booking exists before fetching recordings.","Stop polling recordings once a booking 404s.","Treat a missing booking as terminal for recording retrieval."],"tags":["cal-video","booking","not-found","api-v2","recordings","validation"],"backgroundTag":null,"analyzedSha":"176037d0afbe572f870a3c702985e7cd83fe6c0c","analyzedAt":"2026-08-12T19:12:41.464Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}