{"record":{"id":"177c8f36f76461aa","repo":"calcom/cal.diy","slug":"booking-reference-not-found","errorCode":null,"errorMessage":"Booking reference not found","messagePattern":"Booking reference not found","errorType":"http","errorClass":"NotFoundException","httpStatus":404,"severity":"warning","filePath":"apps/api/v2/src/modules/cal-unified-calendars/services/google-calendar.service.ts","lineNumber":38,"sourceCode":"import { GoogleCalendarService as GCalService } from \"@/platform/calendars/services/gcal.service\";\nimport { GoogleCalendarEventResponse } from \"@/modules/cal-unified-calendars/pipes/get-calendar-event-details-output-pipe\";\nimport { CredentialsRepository } from \"@/modules/credentials/credentials.repository\";\n\n@Injectable()\nexport class GoogleCalendarService {\n  private logger = new Logger(\"GoogleCalendarService\");\n  constructor(\n    private readonly bookingReferencesRepository: BookingReferencesRepository_2024_08_13,\n    private readonly gCalService: GCalService,\n    private readonly credentialsRepository: CredentialsRepository\n  ) {}\n\n  async getEventDetails(eventUid: string): Promise<GoogleCalendarEventResponse> {\n    const bookingReference =\n      await this.bookingReferencesRepository.getBookingReferencesIncludeSensitiveCredentials(eventUid);\n\n    if (!bookingReference) {\n      throw new NotFoundException(\"Booking reference not found\");\n    }\n\n    const ownerUserEmail = bookingReference?.booking?.user?.email;\n\n    // Get authenticated calendar instance\n    const calendar = await this.getAuthorizedCalendarInstance(\n      ownerUserEmail,\n      bookingReference.credential?.key,\n      bookingReference.delegationCredential\n    );\n\n    try {\n      const event = await calendar.events.get({\n        calendarId: bookingReference?.externalCalendarId ?? \"primary\",\n        eventId: bookingReference?.uid,\n        // fields: \"id,status,created,updated,summary,description,location,creator,organizer,start,end,attendees,conferenceData\"\n      });\n","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/calcom/cal.diy/blob/176037d0afbe572f870a3c702985e7cd83fe6c0c/apps/api/v2/src/modules/cal-unified-calendars/services/google-calendar.service.ts#L20-L56","documentation":"GoogleCalendarService.getEventDetails throws NotFoundException when getBookingReferencesIncludeSensitiveCredentials(eventUid) returns null. The eventUid passed in does not match any row in the booking references table (the calendar-event pointer stored against a Cal.com booking).","triggerScenarios":"GET /v2/.../events/:eventUid where eventUid was never created by Cal.com, was for a non-Google calendar, or was deleted. The booking reference is the link between a Cal.com booking and its external Google Calendar event.","commonSituations":"Passing the booking id instead of the booking reference uid; the booking was created on a different calendar provider; the reference row was pruned; testing with a fabricated uid.","solutions":["Look up the correct uid via the bookings API (GET /v2/bookings) and pass the booking reference's uid, not the booking id.","Confirm the booking was created with a Google Calendar destination.","If the reference was deleted intentionally, treat the event as no-longer-accessible rather than retrying."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const refs = await api.v2.bookings.list(/* ... */);\nconst ref = refs.find(r => r.uid === eventUid);\nif (!ref) throw new Error(`No booking reference for uid ${eventUid}; check GET /v2/bookings`);","typeGuard":null,"tryCatchPattern":"try {\n  await api.v2.calUnified.getEvent(eventUid);\n} catch (err) {\n  if (err?.statusCode === 404 && /Booking reference not found/i.test(err?.message)) {\n    // surface 'unknown event' to the UI rather than retry\n  }\n  throw err;\n}","preventionTips":["Pass the booking reference uid, not the booking id.","Cache the reference uid from the booking creation response and reuse it.","Confirm the booking is on Google Calendar before calling the unified-google endpoints."],"tags":["calendar","google-calendar","booking-reference","not-found","api-v2"],"backgroundTag":null,"analyzedSha":"176037d0afbe572f870a3c702985e7cd83fe6c0c","analyzedAt":"2026-08-12T19:12:41.464Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}