calcom/cal.diy · error · UnprocessableEntityException

Can't book this team event type because it has no hosts. Ple

Error message

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.

What it means

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.

Source

Thrown at apps/api/v2/src/platform/bookings/2024-08-13/services/bookings.service.ts:163

        return await this.createRecurringSeatedBooking(request, body, eventType, userIsEventTypeAdminOrOwner);
      }
      if (isRecurring && !isSeated) {
        return await this.createRecurringBooking(request, body, eventType);
      }
      if (isSeated) {
        return await this.createSeatedBooking(request, body, eventType, userIsEventTypeAdminOrOwner);
      }

      return await this.createRegularBooking(request, body, eventType);
    } catch (error) {
      this.errorsBookingsService.handleBookingError(error, bookingTeamEventType);
    }
  }

  async checkEventTypeHasHosts(eventTypeId: number) {
    const eventType = await this.eventTypesRepository.getEventTypeWithHosts(eventTypeId);
    if (!eventType?.hosts?.length) {
      throw new UnprocessableEntityException(
        `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.`
      );
    }
  }

  async checkBookingRequiresAuthenticationSetting(
    eventType: EventTypeWithOwnerAndTeam,
    authUser: AuthOptionalUser,
    userIsEventTypeAdminOrOwner: boolean
  ) {
    if (!eventType.bookingRequiresAuthentication) return true;
    if (!authUser) {
      throw new UnauthorizedException(
        "checkBookingRequiresAuthentication - request must be authenticated by passing credentials belonging to event type owner, host or team or org admin or owner."
      );
    }

    if (!userIsEventTypeAdminOrOwner) {

View on GitHub (pinned to 176037d0af)

Solutions

  1. Add at least one host to the event type via the UI or the event types API (manageEventTeamMutation / hosts endpoint).
  2. Change the event type's scheduling type to one that doesn't require hosts if team assignment isn't intended.
  3. Confirm the eventTypeId is the correct (non-empty) team event type.
Defensive patterns

Strategy: validation

Validate before calling

// Before booking a COLLECTIVE/ROUND_ROBIN event type, confirm it has hosts.
const eventType = await api.get(`/v2/event-types/${eventTypeId}`);
if (eventType.schedulingType === 'COLLECTIVE' || eventType.schedulingType === 'ROUND_ROBIN') {
  const hosts = await api.get(`/v2/event-types/${eventTypeId}/hosts`);
  if (!hosts.length) throw new Error(`Event type ${eventTypeId} has no hosts; add at least one before booking`);
}

Type guard

function teamEventTypeHasHosts(et: { schedulingType?: string; hosts?: unknown[] } | null | undefined): boolean {
  if (!et) return false;
  if (et.schedulingType !== 'COLLECTIVE' && et.schedulingType !== 'ROUND_ROBIN') return true;
  return Array.isArray(et.hosts) && et.hosts.length > 0;
}

Try / catch

try {
  await api.post('/v2/bookings', { eventTypeId });
} catch (err) {
  if (err.status === 422 && /has no hosts/.test(err.message)) {
    // add a host to the event type, then retry
  }
  throw err;
}

Prevention

When it happens

Trigger: POST /v2/bookings with an eventTypeId whose schedulingType is COLLECTIVE or ROUND_ROBIN, and the event type has no rows in its hosts relation.

Common situations: Newly created team event type before hosts were added; all hosts removed; host users deleted; event type migrated without carrying host assignments.

Related errors


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