{"record":{"id":"cd5bbfa0b084c66c","repo":"calcom/cal.diy","slug":"booking-with-uid-bookinguid-not-found-cd5bbf","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/bookings.service.ts","lineNumber":1197,"sourceCode":"        bookingId: booking.id,\n        confirmed: false,\n        recurringEventId: booking.recurringEventId ?? undefined,\n        reason,\n        emailsEnabled,\n        platformClientParams,\n        actionSource: \"API_V2\",\n        actor: makeUserActor(requestUser.uuid),\n      },\n    });\n\n    return this.getBooking(bookingUid, requestUser);\n  }\n\n  async getCalendarLinks(bookingUid: string): Promise<CalendarLink[]> {\n    const booking = await this.bookingsRepository.getByUidWithAttendeesAndUserAndEvent(bookingUid);\n\n    if (!booking) {\n      throw new NotFoundException(`Booking with uid ${bookingUid} not found`);\n    }\n\n    if (!booking.eventTypeId) {\n      throw new BadRequestException(`Booking with uid ${bookingUid} has no event type`);\n    }\n\n    const eventType = await this.eventTypesRepository.getEventTypeByIdIncludeUsersAndTeam(\n      booking.eventTypeId\n    );\n    if (!eventType) {\n      throw new BadRequestException(`Booking with uid ${bookingUid} has no event type`);\n    }\n    // TODO: Maybe we should get locale from query params?\n    return getCalendarLinks({\n      booking,\n      eventType: {\n        ...eventType,\n        // TODO: Support dynamic event bookings later. It would require a slug input it seems","sourceCodeStart":1179,"sourceCodeEnd":1215,"githubUrl":"https://github.com/calcom/cal.diy/blob/176037d0afbe572f870a3c702985e7cd83fe6c0c/apps/api/v2/src/platform/bookings/2024-08-13/services/bookings.service.ts#L1179-L1215","documentation":"Thrown by BookingsService.getCalendarLinks when getByUidWithAttendeesAndUserAndEvent(bookingUid) returns null. NestJS NotFoundException (HTTP 404). The booking uid supplied to the calendar-links endpoint does not exist, so no calendar links can be generated.","triggerScenarios":"GET /v2/bookings/{uid}/calendar-links with a non-existent bookingUid; booking deleted before the call.","commonSituations":"Generating add-to-calendar links from stale client state; referencing a draft booking that was never persisted; environment mismatch.","solutions":["Verify the booking exists with GET /v2/bookings/{uid} before requesting calendar links.","Regenerate the uid from the authoritative booking response rather than cached state.","Handle 404 gracefully by hiding the calendar-link UI for missing bookings.","Confirm environment consistency."],"exampleFix":"// before\nconst links = await apiClient.get(`/v2/bookings/${uid}/calendar-links`);\n\n// after\nconst booking = await apiClient.get(`/v2/bookings/${uid}`).then(r => r.data).catch(() => null);\nif (!booking) return [];\nconst links = await apiClient.get(`/v2/bookings/${uid}/calendar-links`);","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 calendar links`); return []; }","typeGuard":"function isBookingUid(value: string): boolean {\n  return typeof value === 'string' && /^[A-Za-z0-9_-]{8,}$/.test(value.trim());\n}","tryCatchPattern":"try {\n  return await apiClient.get(`/v2/bookings/${uid}/calendar-links`).then(r => r.data);\n} catch (err) {\n  if (err.response?.status === 404) return [];\n  throw err;\n}","preventionTips":["Derive the uid from the authoritative booking response.","Hide calendar-link UI for missing/non-existent bookings.","Validate the uid before the request."],"tags":["booking","not-found","calendar","api-v2","validation"],"backgroundTag":null,"analyzedSha":"176037d0afbe572f870a3c702985e7cd83fe6c0c","analyzedAt":"2026-08-12T19:12:41.464Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}