{"record":{"id":"0bb1b08d7eeda9fd","repo":"calcom/cal.diy","slug":"booking-with-uid-bookinguid-has-no-event-type","errorCode":null,"errorMessage":"Booking with uid ${bookingUid} has no event type","messagePattern":"Booking with uid (.+?) has no event type","errorType":"exception","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"apps/api/v2/src/platform/bookings/2024-08-13/services/bookings.service.ts","lineNumber":1201,"sourceCode":"        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\n        isDynamic: false,\n      },\n      // It can be made customizable through the API endpoint later.\n      t: await getTranslation(\"en\", \"common\"),","sourceCodeStart":1183,"sourceCodeEnd":1219,"githubUrl":"https://github.com/calcom/cal.diy/blob/176037d0afbe572f870a3c702985e7cd83fe6c0c/apps/api/v2/src/platform/bookings/2024-08-13/services/bookings.service.ts#L1183-L1219","documentation":"Thrown by getCalendarLinks when the booking exists but booking.eventTypeId is falsy. NestJS BadRequestException (HTTP 400). Calendar links require an event type to derive duration, location, and metadata, so a booking without an event type (ad-hoc/managed bookings) cannot produce them.","triggerScenarios":"GET calendar-links on a booking created without an event type (e.g., platform-managed or dynamically created bookings); bookings whose eventTypeId column is null.","commonSituations":"Platform bookings created via low-level endpoints that skip event-type assignment; legacy data; workflows that book directly without an event type.","solutions":["Check booking.eventTypeId from GET /v2/bookings/{uid} before requesting calendar links.","If the booking should have an event type, backfill eventTypeId on the booking.","Skip calendar-link generation for bookings without an event type.","Use an event-type-backed booking creation flow going forward."],"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);\nif (!booking.eventTypeId) throw new Error(`Booking ${uid} has no event type; calendar links unavailable`);\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);\nif (!booking.eventTypeId) {\n  throw new Error(`Booking ${uid} has no event type; calendar links are unavailable`);\n}","typeGuard":"function hasEventTypeId(b: { eventTypeId?: number | null }): b is { eventTypeId: number } {\n  return b?.eventTypeId != null;\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 === 400 && /has no event type/i.test(err.response?.data?.message ?? '')) return [];\n  throw err;\n}","preventionTips":["Only offer calendar links for event-type-backed bookings.","Backfill eventTypeId on ad-hoc bookings if links are required.","Check booking.eventTypeId before rendering the calendar-link action."],"tags":["calendar","event-type","booking","api-v2","bad-request"],"backgroundTag":null,"analyzedSha":"176037d0afbe572f870a3c702985e7cd83fe6c0c","analyzedAt":"2026-08-12T19:12:41.464Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}