{"record":{"id":"2bdc9b1b40b71eef","repo":"calcom/cal.diy","slug":"google-meet-requires-a-google-calendar-connection","errorCode":null,"errorMessage":"Google Meet requires a Google Calendar connection.","messagePattern":"Google Meet requires a Google Calendar connection\\.","errorType":"http","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"apps/api/v2/src/modules/conferencing/services/google-meet.service.ts","lineNumber":52,"sourceCode":"    );\n    if (googleMeetExists) {\n      throw new BadRequestException(\"Google Meet is already connected for this team.\");\n    }\n\n    return this.credentialsRepository.upsertTeamAppCredential(GOOGLE_MEET_TYPE, {}, teamId);\n  }\n\n  /**\n   * Validate that Google Calendar is connected and valid for either a user or a team.\n   */\n  private async validateGoogleCalendarConnection(id: number, entity: \"user\" | \"team\") {\n    const googleCalendar =\n      entity === \"user\"\n        ? await this.credentialsRepository.findCredentialByTypeAndUserId(GOOGLE_CALENDAR_TYPE, id)\n        : await this.credentialsRepository.findCredentialByTypeAndTeamId(GOOGLE_CALENDAR_TYPE, id);\n\n    if (!googleCalendar) {\n      throw new BadRequestException(\"Google Meet requires a Google Calendar connection.\");\n    }\n\n    if (googleCalendar.invalid) {\n      throw new BadRequestException(\n        \"Google Meet requires a valid Google Calendar connection. Please reconnect Google Calendar.\"\n      );\n    }\n  }\n}\n","sourceCodeStart":34,"sourceCodeEnd":62,"githubUrl":"https://github.com/calcom/cal.diy/blob/176037d0afbe572f870a3c702985e7cd83fe6c0c/apps/api/v2/src/modules/conferencing/services/google-meet.service.ts#L34-L62","documentation":"Thrown inside validateGoogleCalendarConnection when no Google Calendar credential is found for the user or team. Google Meet is implemented as a dependent app: it requires a valid Google Calendar credential to exist first. The check runs findCredentialByTypeAndUserId or findCredentialByTypeAndTeamId for GOOGLE_CALENDAR_TYPE; a falsy result raises a BadRequestException (HTTP 400).","triggerScenarios":"Calling connectGoogleMeetToUser or connectGoogleMeetToTeam for an entity that has never connected Google Calendar, or whose Google Calendar credential was deleted. The guard fires before any Google Meet credential is written.","commonSituations":"Onboarding a team that skips the Google Calendar step; a user connects Outlook/Office365 calendar then tries Google Meet; Google Calendar credential revoked from the Google side and pruned; wrong teamId/userId passed.","solutions":["Connect Google Calendar first for the same user or team, then retry the Google Meet connect.","Verify the correct userId/teamId is being passed (mismatched scope is the most common cause).","If Google Calendar was connected but revoked, re-run the Google Calendar OAuth flow to recreate the credential."],"exampleFix":"// before\nawait googleMeetService.connectGoogleMeetToUser(userId);\n\n// after\nconst hasGcal = await credentialsRepository.findCredentialByTypeAndUserId(GOOGLE_CALENDAR_TYPE, userId);\nif (!hasGcal) {\n  await googleCalendarService.connect(userId);\n}\nawait googleMeetService.connectGoogleMeetToUser(userId);","handlingStrategy":"validation","validationCode":"const hasGcal = entity === 'team'\n  ? await credentialsRepository.findCredentialByTypeAndTeamId(GOOGLE_CALENDAR_TYPE, id)\n  : await credentialsRepository.findCredentialByTypeAndUserId(GOOGLE_CALENDAR_TYPE, id);\nif (!hasGcal) {\n  throw new Error('Connect Google Calendar before Google Meet.');\n}\nawait googleMeetService.connect(entity, id);","typeGuard":null,"tryCatchPattern":"try {\n  await googleMeetService.connectGoogleMeetToUser(userId);\n} catch (e) {\n  if (e instanceof BadRequestException && /requires a Google Calendar connection/.test(e.message)) {\n    await googleCalendarService.connect(userId);\n    return googleMeetService.connectGoogleMeetToUser(userId);\n  }\n  throw e;\n}","preventionTips":["Enforce a connection wizard order: Google Calendar must be connected before Google Meet.","Surface the calendar prerequisite in the UI next to the Google Meet connect action.","Run a preflight check in the controller and return a structured precondition error."],"tags":["conferencing","google-meet","google-calendar","dependency","precondition"],"backgroundTag":null,"analyzedSha":"176037d0afbe572f870a3c702985e7cd83fe6c0c","analyzedAt":"2026-08-12T19:12:41.464Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}