calcom/cal.diy · error · BadRequestException
Cannot reserve a slot for a team event without any hosts
Error message
Cannot reserve a slot for a team event without any hosts
What it means
A NestJS BadRequestException (HTTP 400) from SlotsService_2024_09_04.reserveSlot. The event type is a team event (no eventType.userId) and eventType.hosts[0] is undefined — the team event has zero hosts assigned. The reserve flow needs a host to attach the slot to, so it refuses.
Source
Thrown at apps/api/v2/src/modules/slots/slots-2024-09-04/services/slots.service.ts:187
}
const reservationDuration = input.reservationDuration ?? DEFAULT_RESERVATION_DURATION;
if (eventType.userId) {
const slot = await this.slotsRepository.createSlot(
eventType.userId,
eventType.id,
startDate.toISO(),
endDate.toISO(),
eventType.seatsPerTimeSlot !== null,
reservationDuration
);
return this.slotsOutputService.getReservationSlotCreated(slot, reservationDuration);
}
const host = eventType.hosts[0];
if (!host) {
throw new BadRequestException("Cannot reserve a slot for a team event without any hosts");
}
const slot = await this.slotsRepository.createSlot(
host.userId,
eventType.id,
startDate.toISO(),
endDate.toISO(),
eventType.seatsPerTimeSlot !== null,
reservationDuration
);
return this.slotsOutputService.getReservationSlotCreated(slot, reservationDuration);
}
private async checkSlotOverlap(eventTypeId: number, startDate: string, endDate: string) {
const overlappingReservation = await this.slotsRepository.getOverlappingSlotReservation(
eventTypeId,
startDate,View on GitHub (pinned to 176037d0af)
Solutions
- Assign at least one host to the team event type in the Cal.com dashboard before reserving.
- Verify via GET /v2/event-types that hosts.length > 0 before calling reserve.
- Surface a 'no hosts available' message and ask the event owner to add members.
- If hosts exist in the DB but are not loaded, check the repository includes hosts in the query.
Example fix
// before
await reserve(teamEventTypeId, slotStart); // hosts: []
// after
const et = await calApi.eventTypes.getById(teamEventTypeId);
if (!et.hosts?.length) throw new ClientError('Team event has no hosts — ask owner to add members');
await reserve(teamEventTypeId, slotStart); Defensive patterns
Strategy: validation
Validate before calling
async function assertTeamEventHasHosts(eventTypeId: number) {
const et = await cal.eventTypes.getById(eventTypeId);
if (!et) throw new ClientError('Event type not found');
if (et.teamId && !(et.hosts?.length)) {
throw new UserFacingError('Team event has no hosts — ask the owner to add members.');
}
return et;
}
await assertTeamEventHasHosts(eventTypeId); Type guard
function teamEventHasHosts(et: { teamId?: number | null; hosts?: unknown[] }): boolean {
return !et.teamId || (Array.isArray(et.hosts) && et.hosts.length > 0);
} Try / catch
try {
await cal.slots.reserve({ eventTypeId, slotStart });
} catch (e) {
if (e instanceof HttpError && e.statusCode === 400 && /without any hosts/i.test(e.message)) {
throw new UserFacingError('This team event has no hosts yet — please contact the organizer.');
}
throw e;
} Prevention
- Verify hosts.length > 0 before reserving team events.
- Surface a configuration error to the event owner.
- Add at least one host when creating team/round-robin event types.
- Confirm the repository query includes hosts.
When it happens
Trigger: POST /v2/slots/reserve for a team event type whose hosts array is empty — all members were removed, or the event type was created without assigning hosts.
Common situations: Team event configured but no members added; hosts transferred out of the team; race between team setup and a reserve call; misconfigured round-robin event with an empty host list.
Related errors
- Invalid start date
- Invalid end date
- Could not adjust timezone for slot ${slot.time} with timezon
- Could not adjust timezone for slot end time ${slot.time} wit
- Could not create UTC time for slot ${slot.time}
AI-assisted analysis of calcom/cal.diy@176037d0af (2026-08-12).
Data as JSON: /api/errors/a96be27ac551fc41.
Report an issue: GitHub.