calcom/cal.diy · error · NotFoundException

Event type with uid ${uid} not found

Error message

Event type with uid ${uid} not found

What it means

Thrown by EventTypesAtomService.getUserPaymentInfo when the payment and booking both exist, but the booking's eventType relation is null. The code destructures eventType from _booking (the booking relation), and if it's absent, the event type metadata, users, team, and profile information cannot be assembled, so NotFoundException (HTTP 404) is thrown. This indicates the booking references an event type that no longer exists.

Source

Thrown at apps/api/v2/src/modules/atoms/services/event-types-atom.service.ts:328

    return apps[0];
  }

  async getUserPaymentInfo(uid: string) {
    const rawPayment = await this.atomsRepository.getRawPayment(uid);
    if (!rawPayment) throw new NotFoundException(`Payment with uid ${uid} not found`);
    const { data, booking: _booking, ...restPayment } = rawPayment;
    const payment = {
      ...restPayment,
      data: data as Record<string, unknown>,
    };
    if (!_booking) throw new NotFoundException(`Booking with uid ${uid} not found`);
    const { startTime, endTime, eventType, ...restBooking } = _booking;
    const booking = {
      ...restBooking,
      startTime: startTime.toString(),
      endTime: endTime.toString(),
    };
    if (!eventType) throw new NotFoundException(`Event type with uid ${uid} not found`);
    if (eventType.users.length === 0 && !eventType.team)
      throw new NotFoundException(`No users found or no team present for event type with uid ${uid}`);
    const [user] = eventType?.users.length
      ? eventType.users
      : [{ name: null, theme: null, hideBranding: null, username: null }];
    const profile = {
      name: eventType.team?.name || user?.name || null,
      theme: (!eventType.team?.name && user?.theme) || null,
      hideBranding: eventType.team?.hideBranding || user?.hideBranding || null,
    };
    return {
      user,
      eventType: {
        ...eventType,
        metadata: EventTypeMetaDataSchema.parse(eventType.metadata),
      },
      booking,
      payment,

View on GitHub (pinned to 176037d0af)

Solutions

  1. Check the booking's eventTypeId in the database: SELECT id, eventTypeId FROM booking WHERE uid = <booking_uid>.
  2. Verify the eventTypeId still exists in the EventType table; if deleted, this is a data integrity issue.
  3. Restore the deleted event type or update the booking to reference a valid event type if appropriate.
  4. If this is read-replica lag, retry the request after a brief delay.

Example fix

// before: no handling for missing event type on payment info
const info = await api.get(`/v2/atoms/payment-info/${paymentUid}`);
// 404: Event type with uid not found

// after: check data integrity and handle gracefully
// DB diagnostic query:
// SELECT b.uid, b.eventTypeId, et.id as et_exists
// FROM "Booking" b LEFT JOIN "EventType" et ON b."eventTypeId" = et.id
// WHERE b.uid = '<booking_uid>' AND et.id IS NULL;
// If results found: orphaned booking referencing a deleted event type.
// Fix: either restore the event type or null-out the payment's booking association.
Defensive patterns

Strategy: try-catch

Validate before calling

// Verify the booking's event type still exists before querying payment info
const verifyEventTypeForBooking = async (api: ApiClient, paymentUid: string): Promise<void> => {
  const payment = await api.get(`/v2/payments/${paymentUid}`);
  if (!payment?.booking?.eventTypeId) {
    throw new Error('Booking has no event type. The event type may have been deleted.');
  }
};

Try / catch

// Handle orphaned event type on payment info
try {
  return await api.get(`/v2/atoms/payment-info/${uid}`);
} catch (err: any) {
  const msg = err?.response?.data?.message ?? '';
  if (err?.response?.status === 404 && msg.includes('Event type with uid')) {
    // Event type was deleted; return partial info or notify admin
    return { error: 'event_type_deleted', paymentUid: uid };
  }
  throw err;
}

Prevention

When it happens

Trigger: A booking exists whose eventTypeId references a deleted event type. The event type was hard-deleted after the booking was created but before the payment info was queried. A data migration removed event types without updating bookings. The booking was created through a legacy flow that didn't properly set the event type relation.

Common situations: Admin deletes an event type that has existing bookings with payments. A test or seed script created bookings with invalid eventTypeId references. Schema migration that changed event type IDs without updating booking foreign keys. Read replica lag where the event type hasn't propagated.

Related errors


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