calcom/cal.diy · error · NotFoundException

No users found or no team present for event type with uid ${

Error message

No users found or no team present for event type with uid ${uid}

What it means

Thrown by EventTypesAtomService.getUserPaymentInfo when the event type exists but has zero users in its users relation AND no team assigned. The code at line 329 checks eventType.users.length === 0 && !eventType.team, meaning the event type is effectively orphaned — it has no individual assignees and no team owner. Without either, the profile (name, theme, hideBranding) cannot be determined, so the response is incomplete and a NotFoundException (HTTP 404) is thrown.

Source

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

  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,
      clientSecret: getClientSecretFromPayment(payment),
      profile,

View on GitHub (pinned to 176037d0af)

Solutions

  1. Check the EventTypeUser join table: verify that users are assigned to the event type via SELECT * FROM "EventTypeUser" WHERE eventTypeId = <id>.
  2. If users were removed, reassign at least one user or set a team on the event type.
  3. For managed team event types, ensure the team relation is properly set in the EventType table.
  4. Run a data integrity audit for event types with no users and no team: SELECT et.id FROM "EventType" et WHERE NOT EXISTS (SELECT 1 FROM "EventTypeUser" etu WHERE etu."eventTypeId" = et.id) AND et.teamId IS NULL.

Example fix

// before: no pre-check for event type ownership
// (no client-side fix; this is a server-side data integrity issue)

// after: diagnostic and remediation
// 1. Diagnose:
//    SELECT et.id, et.slug,
//      (SELECT count(*) FROM "EventTypeUser" etu WHERE etu."eventTypeId" = et.id) as user_count,
//      et."teamId"
//    FROM "EventType" et
//    WHERE et.id = <event_type_id>;
// 2. Remediate:
//    INSERT INTO "EventTypeUser" ("eventTypeId", "userId") VALUES (<et_id>, <user_id>);
//    -- OR: UPDATE "EventType" SET "teamId" = <team_id> WHERE id = <et_id>;
Defensive patterns

Strategy: validation

Validate before calling

// Check event type has at least one user or a team before relying on it
const verifyEventTypeOwnership = (eventType: {
  users?: unknown[];
  team?: unknown | null;
}): void => {
  const hasUsers = (eventType.users?.length ?? 0) > 0;
  const hasTeam = eventType.team != null;
  if (!hasUsers && !hasTeam) {
    throw new Error('Event type has no assigned users and no team. Data integrity issue.');
  }
};

Type guard

interface OwnedEventType {
  users: unknown[];
  team?: { id: number } | null;
}
const isOwnedEventType = (et: { users?: unknown[]; team?: unknown }): et is OwnedEventType =>
  (et.users?.length ?? 0) > 0 || et.team != null;

Try / catch

// Handle orphaned event type in 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('No users found')) {
    // Event type is orphaned; alert data team
    alertDataTeam(`Orphaned event type detected for payment ${uid}`);
    return null;
  }
  throw err;
}

Prevention

When it happens

Trigger: An event type where all assigned users were deleted or removed, and the event type has no team. A managed event type whose team assignment was cleared. A data migration that restructured user-event-type assignments and left the relation empty. A circular reference issue where the event type points to users that no longer exist.

Common situations: User account deletion without reassigning their event types. Team event type converted to a user event type but with the team relation cleared and no users assigned. Seed data or test fixtures that create event types without users or teams. Org restructuring that moved all users away from an event type.

Related errors


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