calcom/cal.diy · error · BadRequestException

Booking with uid ${bookingUid} has no event type

Error message

Booking with uid ${bookingUid} has no event type

What it means

Thrown by getCalendarLinks when the booking exists but booking.eventTypeId is falsy. NestJS BadRequestException (HTTP 400). Calendar links require an event type to derive duration, location, and metadata, so a booking without an event type (ad-hoc/managed bookings) cannot produce them.

Source

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

        emailsEnabled,
        platformClientParams,
        actionSource: "API_V2",
        actor: makeUserActor(requestUser.uuid),
      },
    });

    return this.getBooking(bookingUid, requestUser);
  }

  async getCalendarLinks(bookingUid: string): Promise<CalendarLink[]> {
    const booking = await this.bookingsRepository.getByUidWithAttendeesAndUserAndEvent(bookingUid);

    if (!booking) {
      throw new NotFoundException(`Booking with uid ${bookingUid} not found`);
    }

    if (!booking.eventTypeId) {
      throw new BadRequestException(`Booking with uid ${bookingUid} has no event type`);
    }

    const eventType = await this.eventTypesRepository.getEventTypeByIdIncludeUsersAndTeam(
      booking.eventTypeId
    );
    if (!eventType) {
      throw new BadRequestException(`Booking with uid ${bookingUid} has no event type`);
    }
    // TODO: Maybe we should get locale from query params?
    return getCalendarLinks({
      booking,
      eventType: {
        ...eventType,
        // TODO: Support dynamic event bookings later. It would require a slug input it seems
        isDynamic: false,
      },
      // It can be made customizable through the API endpoint later.
      t: await getTranslation("en", "common"),

View on GitHub (pinned to 176037d0af)

Solutions

  1. Check booking.eventTypeId from GET /v2/bookings/{uid} before requesting calendar links.
  2. If the booking should have an event type, backfill eventTypeId on the booking.
  3. Skip calendar-link generation for bookings without an event type.
  4. Use an event-type-backed booking creation flow going forward.

Example fix

// before
const links = await apiClient.get(`/v2/bookings/${uid}/calendar-links`);

// after
const booking = await apiClient.get(`/v2/bookings/${uid}`).then(r => r.data);
if (!booking.eventTypeId) throw new Error(`Booking ${uid} has no event type; calendar links unavailable`);
const links = await apiClient.get(`/v2/bookings/${uid}/calendar-links`);
Defensive patterns

Strategy: validation

Validate before calling

const booking = await apiClient.get(`/v2/bookings/${uid}`).then(r => r.data);
if (!booking.eventTypeId) {
  throw new Error(`Booking ${uid} has no event type; calendar links are unavailable`);
}

Type guard

function hasEventTypeId(b: { eventTypeId?: number | null }): b is { eventTypeId: number } {
  return b?.eventTypeId != null;
}

Try / catch

try {
  return await apiClient.get(`/v2/bookings/${uid}/calendar-links`).then(r => r.data);
} catch (err) {
  if (err.response?.status === 400 && /has no event type/i.test(err.response?.data?.message ?? '')) return [];
  throw err;
}

Prevention

When it happens

Trigger: GET calendar-links on a booking created without an event type (e.g., platform-managed or dynamically created bookings); bookings whose eventTypeId column is null.

Common situations: Platform bookings created via low-level endpoints that skip event-type assignment; legacy data; workflows that book directly without an event type.

Related errors


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