calcom/cal.diy · error · NotFoundException

Event Type not found

Error message

Event Type not found

What it means

NotFoundException (HTTP 404) thrown by SlotsService_2024_04_15.reserveSlot() when eventTypeRepo.getEventTypeWithSeats(input.eventTypeId) returns null. Reserve-slot (seated-event booking hold) requires an existing event type configured for seats; a missing or inaccessible event type id is rejected before any seat accounting runs.

Source

Thrown at apps/api/v2/src/modules/slots/slots-2024-04-15/services/slots.service.ts:19

import { EventTypesRepository_2024_04_15 } from "@/platform/event-types/event-types_2024_04_15/event-types.repository";
import { SlotsRepository_2024_04_15 } from "@/modules/slots/slots-2024-04-15/slots.repository";
import { Injectable, NotFoundException } from "@nestjs/common";
import { v4 as uuid } from "uuid";

import { ReserveSlotInput_2024_04_15 } from "@calcom/platform-types";

@Injectable()
export class SlotsService_2024_04_15 {
  constructor(
    private readonly eventTypeRepo: EventTypesRepository_2024_04_15,
    private readonly slotsRepo: SlotsRepository_2024_04_15
  ) {}

  async reserveSlot(input: ReserveSlotInput_2024_04_15, headerUid?: string) {
    const uid = headerUid || uuid();
    const eventType = await this.eventTypeRepo.getEventTypeWithSeats(input.eventTypeId);
    if (!eventType) {
      throw new NotFoundException("Event Type not found");
    }

    let shouldReserveSlot = true;
    if (eventType.seatsPerTimeSlot) {
      const bookingWithAttendees = input.bookingUid
        ? await this.slotsRepo.getBookingWithAttendees(input.bookingUid)
        : undefined;
      const bookingAttendeesLength = bookingWithAttendees?.attendees?.length;
      if (bookingAttendeesLength) {
        const seatsLeft = eventType.seatsPerTimeSlot - bookingAttendeesLength;
        if (seatsLeft < 1) shouldReserveSlot = false;
      } else {
        shouldReserveSlot = false;
      }
    }

    if (eventType && shouldReserveSlot && !input._isDryRun) {
      await Promise.all(

View on GitHub (pinned to 176037d0af)

Solutions

  1. Re-fetch the event type before attempting to reserve; if it 404s, refresh the user's event-type list.
  2. Capture the eventTypeId at booking-start time and fail the flow gracefully if the event type disappears.
  3. Ensure the client only shows currently-available seated event types for the reserve action.

Example fix

// before
await api.reserveSlot({ eventTypeId: cachedId, slotUid });
// after — validate existence first
const et = await api.getEventType(cachedId).catch(() => null);
if (!et) { refreshEventTypes(); return; }
await api.reserveSlot({ eventTypeId: cachedId, slotUid });
Defensive patterns

Strategy: try-catch

Validate before calling

async function reserveSlotGuarded(eventTypeId: number, input: ReserveInput) {
  const et = await api.getEventTypeWithSeats(eventTypeId).catch(() => null);
  if (!et) throw new Error(`Event type ${eventTypeId} not found`);
  return api.reserveSlot({ ...input, eventTypeId });
}

Type guard

const eventTypeWithSeatsExists = async (eventTypeId: number): Promise<boolean> =>
  Boolean(await api.getEventTypeWithSeats(eventTypeId).catch(() => null));

Try / catch

try { await api.reserveSlot({ eventTypeId, slotUid }); }
catch (e) { if (e.status === 404) { refreshEventTypes(); } else throw e; }

Prevention

When it happens

Trigger: POST /v2/slots/2024-04-15/{eventTypeId}/reserve (or the reserve-slot input path) with an eventTypeId that does not exist, was deleted, or is outside the caller's scope; reserving a slot for a non-seated event type id that was removed.

Common situations: Stale eventTypeId held in the client after the event type was deleted; deep link to a seated event that no longer exists; race between deletion and a reserve call; cross-org eventTypeId leak.

Related errors


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