diff --git a/packages/trpc/server/routers/viewer/teams/roundRobin/getRoundRobinHostsToReasign.handler.ts b/packages/trpc/server/routers/viewer/teams/roundRobin/getRoundRobinHostsToReasign.handler.ts index 96b87b9b8e..d220c8d0a0 100644 --- a/packages/trpc/server/routers/viewer/teams/roundRobin/getRoundRobinHostsToReasign.handler.ts +++ b/packages/trpc/server/routers/viewer/teams/roundRobin/getRoundRobinHostsToReasign.handler.ts @@ -56,10 +56,19 @@ export const getRoundRobinHostsToReassign = async ({ ctx, input }: GetRoundRobin // Get event type const eventType = await getEventTypesFromDB(booking.eventType.id); - if (!eventType || !eventType.teamId) { + if (!eventType) { throw new Error("Event type not found"); } + if (!eventType.teamId) { + gettingRoundRobinHostsToReassignLogger.warn("Booking with event type that has no teamId", { + bookingId: input.bookingId, + eventTypeId: eventType.id, + teamId: eventType.teamId ?? -1, + }); + return []; + } + const availableEventTypeUsers = eventType.hosts .filter((h) => !h.isFixed && h.user.id !== booking.userId) .map((host) => ({