{"record":{"id":"32efe5b1145e2190","repo":"calcom/cal.diy","slug":"no-requiredcalendartype-replace-event","errorCode":null,"errorMessage":"No ${requiredCalendarType.replace(\"_\", \" \")} event found for this booking. ${ctx.integrationSlug} requires a ${requiredCalendarType.replace(\"_\", \" \")} event to generate the meeting link.","messagePattern":"No (.+?) event found for this booking\\. (.+?) requires a (.+?) event to generate the meeting link\\.","errorType":"http","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"apps/api/v2/src/platform/bookings/2024-08-13/services/booking-location-integration.service.ts","lineNumber":254,"sourceCode":"    });\n\n    if (videoCallUrl) {\n      await this.calendarSyncService.syncCalendarEvent(ctx.existingBooking.id, bookingLocation);\n    }\n\n    return this.updateBookingWithVideoLocation(ctx, videoCallUrl, bookingLocation, evt);\n  }\n\n  private async handleCalendarBasedIntegration(\n    ctx: IntegrationHandlerContext,\n    requiredCalendarType: string\n  ): Promise<BookingLocationResponse> {\n    const calendarReference = ctx.booking.references.find(\n      (ref) => ref.type.includes(requiredCalendarType) && !ref.deleted\n    );\n\n    if (!calendarReference) {\n      throw new BadRequestException(\n        `No ${requiredCalendarType.replace(\"_\", \" \")} event found for this booking. ${ctx.integrationSlug} requires a ${requiredCalendarType.replace(\"_\", \" \")} event to generate the meeting link.`\n      );\n    }\n\n    const calendarCredential = await this.credentialService.getCredentialForReference(\n      calendarReference,\n      ctx.booking.user?.credentials || []\n    );\n\n    if (!calendarCredential) {\n      throw new BadRequestException(\n        `Could not find calendar credentials for ${ctx.integrationSlug}. Please reconnect your calendar.`\n      );\n    }\n\n    const evt = await this.calendarSyncService.buildCalEventFromBookingData(\n      ctx.booking,\n      ctx.internalLocation,","sourceCodeStart":236,"sourceCodeEnd":272,"githubUrl":"https://github.com/calcom/cal.diy/blob/176037d0afbe572f870a3c702985e7cd83fe6c0c/apps/api/v2/src/platform/bookings/2024-08-13/services/booking-location-integration.service.ts#L236-L272","documentation":"Thrown by handleCalendarBasedIntegration when the booking has no non-deleted reference whose type includes the requiredCalendarType (google_calendar for google-meet, office365_calendar for MS Teams). Calendar-based meeting-link generation works by updating the existing calendar event, so a missing calendar reference leaves nothing to attach the conference to.","triggerScenarios":"PATCH booking location to \"google-meet\" with an explicit Google Calendar path, or \"office365-video\" with an Office365 calendar, when the booking was never synced to that calendar (no reference row). Occurs when the organizer lacked the calendar connected at booking time, or the calendar event reference was marked deleted.","commonSituations":"Organizer connected only the video app but not the matching calendar; booking made before the calendar integration was linked; calendar event reference soft-deleted by a prior edit; google-meet path reached because the booking actually has google_calendar but it was deleted.","solutions":["Have the organizer connect the matching calendar (Google Calendar for Meet, Office365 for Teams) and re-sync the booking so a calendar reference is created.","For google-meet without any Google Calendar, rely on the built-in Cal Video fallback by ensuring no google_calendar reference exists (the code auto-falls-back) — but to get a real Meet link you must connect Google Calendar.","Switch to an integration that does not require a calendar event (e.g. cal-video, or the VideoApi path for Teams)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before PATCHing to a calendar-based integration, confirm a non-deleted calendar reference exists.\nconst refs = await api.get(`/v2/bookings/${uid}/references`);\nconst required = integrationSlug === 'google-meet' ? 'google_calendar' : 'office365_calendar';\nconst hasCalRef = refs.some((r) => r.type.includes(required) && !r.deleted);\nif (!hasCalRef) throw new Error(`No ${required} reference on booking; connect the calendar and re-sync`);","typeGuard":"function hasCalendarReference(refs: { type: string; deleted?: boolean }[], requiredType: string): boolean {\n  return refs.some((r) => r.type.includes(requiredType) && !r.deleted);\n}","tryCatchPattern":"try {\n  await api.patch(`/v2/bookings/${uid}/location`, { location: { type: 'integration', integration: 'google-meet' } });\n} catch (err) {\n  if (err.status === 400 && /event found for this booking/.test(err.message)) {\n    // ask host to connect Google Calendar + re-sync, or switch to cal-video\n  }\n  throw err;\n}","preventionTips":["Connect the matching calendar before expecting Meet/Teams links.","Re-sync the booking after connecting a calendar so a reference is created.","For google-meet without Google Calendar, expect the Cal Video fallback instead of a Meet link."],"tags":["calendar","integration","references","video"],"backgroundTag":null,"analyzedSha":"176037d0afbe572f870a3c702985e7cd83fe6c0c","analyzedAt":"2026-08-12T19:12:41.464Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}