calcom/cal.diy · error · BadRequestException

Could not find calendar credentials for

Error message

Could not find calendar credentials for ${ctx.integrationSlug}. Please reconnect your calendar.

What it means

Thrown by handleCalendarBasedIntegration when a calendar reference exists but credentialService.getCredentialForReference returns no matching credential among the user's credentials. The reference points at a credential ID that no longer exists, so the calendar event cannot be updated to attach the meeting link.

Solutions

  1. Have the organizer reconnect the calendar integration in Settings to create a fresh credential.
  2. Re-sync/re-create the booking's calendar event so a new reference tied to the new credential is generated.
  3. If the credential belongs to a different user, ensure the booking host is the one who owns the connected calendar.
Defensive patterns

Strategy: validation

Validate before calling

// Before PATCHing, confirm the calendar reference has a resolvable credential.
const refs = await api.get(`/v2/bookings/${uid}/references`);
const calRef = refs.find((r) => r.type.includes('google_calendar') && !r.deleted);
if (calRef && !calRef.credentialId) throw new Error('Calendar reference has no credential; reconnect the calendar');

Type guard

function referenceHasCredential(ref: { credentialId?: number | null } | undefined): boolean {
  return !!ref && ref.credentialId != null && ref.credentialId > 0;
}

Try / catch

try {
  await api.patch(`/v2/bookings/${uid}/location`, { location: { type: 'integration', integration: 'google-meet' } });
} catch (err) {
  if (err.status === 400 && /calendar credentials/.test(err.message)) {
    // host must reconnect the calendar and re-sync
  }
  throw err;
}

Prevention

When it happens

Trigger: PATCH booking location to a calendar-based integration (google-meet, office365-video calendar path) where the booking has a non-deleted calendar reference, but the credential row it references has been deleted or does not belong to the booking host.

Common situations: User disconnected the calendar app after the booking was created (credential deleted but reference retained); credential revoked by the provider; user reconnected under a different account so the old credentialId is orphaned; cross-user credential mismatch.

Related errors


AI-assisted analysis of calcom/cal.diy@176037d0af (2026-08-12). Data as JSON: /api/errors/6b6f63c0c149ac8c. Report an issue: GitHub.

Appendix: source

Thrown at apps/api/v2/src/platform/bookings/2024-08-13/services/booking-location-integration.service.ts:265

    requiredCalendarType: string
  ): Promise<BookingLocationResponse> {
    const calendarReference = ctx.booking.references.find(
      (ref) => ref.type.includes(requiredCalendarType) && !ref.deleted
    );

    if (!calendarReference) {
      throw new BadRequestException(
        `No ${requiredCalendarType.replace("_", " ")} event found for this booking. ${ctx.integrationSlug} requires a ${requiredCalendarType.replace("_", " ")} event to generate the meeting link.`
      );
    }

    const calendarCredential = await this.credentialService.getCredentialForReference(
      calendarReference,
      ctx.booking.user?.credentials || []
    );

    if (!calendarCredential) {
      throw new BadRequestException(
        `Could not find calendar credentials for ${ctx.integrationSlug}. Please reconnect your calendar.`
      );
    }

    const evt = await this.calendarSyncService.buildCalEventFromBookingData(
      ctx.booking,
      ctx.internalLocation,
      null
    );

    if (ctx.integrationSlug === "google-meet") {
      evt.conferenceData = {
        createRequest: {
          requestId: `${ctx.booking.uid}-meet`,
        },
      };
    }

View on GitHub (pinned to 176037d0af)