{"record":{"id":"c28c6220dce1d9bb","repo":"calcom/cal.diy","slug":"can-t-book-this-team-event-type-because-it-has-no","errorCode":null,"errorMessage":"Can't book this team event type because it has no hosts. Please, add at least 1 host to event type with id=${eventTypeId} belonging to team with id=${eventType?.teamId} and try again.","messagePattern":"Can't book this team event type because it has no hosts\\. Please, add at least 1 host to event type with id=(.+?) belonging to team with id=(.+?) and try again\\.","errorType":"exception","errorClass":"UnprocessableEntityException","httpStatus":422,"severity":"error","filePath":"apps/api/v2/src/platform/bookings/2024-08-13/services/bookings.service.ts","lineNumber":163,"sourceCode":"        return await this.createRecurringSeatedBooking(request, body, eventType, userIsEventTypeAdminOrOwner);\n      }\n      if (isRecurring && !isSeated) {\n        return await this.createRecurringBooking(request, body, eventType);\n      }\n      if (isSeated) {\n        return await this.createSeatedBooking(request, body, eventType, userIsEventTypeAdminOrOwner);\n      }\n\n      return await this.createRegularBooking(request, body, eventType);\n    } catch (error) {\n      this.errorsBookingsService.handleBookingError(error, bookingTeamEventType);\n    }\n  }\n\n  async checkEventTypeHasHosts(eventTypeId: number) {\n    const eventType = await this.eventTypesRepository.getEventTypeWithHosts(eventTypeId);\n    if (!eventType?.hosts?.length) {\n      throw new UnprocessableEntityException(\n        `Can't book this team event type because it has no hosts. Please, add at least 1 host to event type with id=${eventTypeId} belonging to team with id=${eventType?.teamId} and try again.`\n      );\n    }\n  }\n\n  async checkBookingRequiresAuthenticationSetting(\n    eventType: EventTypeWithOwnerAndTeam,\n    authUser: AuthOptionalUser,\n    userIsEventTypeAdminOrOwner: boolean\n  ) {\n    if (!eventType.bookingRequiresAuthentication) return true;\n    if (!authUser) {\n      throw new UnauthorizedException(\n        \"checkBookingRequiresAuthentication - request must be authenticated by passing credentials belonging to event type owner, host or team or org admin or owner.\"\n      );\n    }\n\n    if (!userIsEventTypeAdminOrOwner) {","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/calcom/cal.diy/blob/176037d0afbe572f870a3c702985e7cd83fe6c0c/apps/api/v2/src/platform/bookings/2024-08-13/services/bookings.service.ts#L145-L181","documentation":"Thrown by checkEventTypeHasHosts for COLLECTIVE or ROUND_ROBIN team event types that have zero hosts. Both scheduling types require at least one host to assign the booking to; with none, booking cannot proceed. Surfaces as HTTP 422 UnprocessableEntityException.","triggerScenarios":"POST /v2/bookings with an eventTypeId whose schedulingType is COLLECTIVE or ROUND_ROBIN, and the event type has no rows in its hosts relation.","commonSituations":"Newly created team event type before hosts were added; all hosts removed; host users deleted; event type migrated without carrying host assignments.","solutions":["Add at least one host to the event type via the UI or the event types API (manageEventTeamMutation / hosts endpoint).","Change the event type's scheduling type to one that doesn't require hosts if team assignment isn't intended.","Confirm the eventTypeId is the correct (non-empty) team event type."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before booking a COLLECTIVE/ROUND_ROBIN event type, confirm it has hosts.\nconst eventType = await api.get(`/v2/event-types/${eventTypeId}`);\nif (eventType.schedulingType === 'COLLECTIVE' || eventType.schedulingType === 'ROUND_ROBIN') {\n  const hosts = await api.get(`/v2/event-types/${eventTypeId}/hosts`);\n  if (!hosts.length) throw new Error(`Event type ${eventTypeId} has no hosts; add at least one before booking`);\n}","typeGuard":"function teamEventTypeHasHosts(et: { schedulingType?: string; hosts?: unknown[] } | null | undefined): boolean {\n  if (!et) return false;\n  if (et.schedulingType !== 'COLLECTIVE' && et.schedulingType !== 'ROUND_ROBIN') return true;\n  return Array.isArray(et.hosts) && et.hosts.length > 0;\n}","tryCatchPattern":"try {\n  await api.post('/v2/bookings', { eventTypeId });\n} catch (err) {\n  if (err.status === 422 && /has no hosts/.test(err.message)) {\n    // add a host to the event type, then retry\n  }\n  throw err;\n}","preventionTips":["Assign at least one host to COLLECTIVE/ROUND_ROBIN event types before exposing them for booking.","Validate hosts exist in the event-type provisioning flow.","When removing hosts, ensure at least one remains for these scheduling types."],"tags":["event-type","team","hosts","booking","unprocessable"],"backgroundTag":null,"analyzedSha":"176037d0afbe572f870a3c702985e7cd83fe6c0c","analyzedAt":"2026-08-12T19:12:41.464Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}