calcom/cal.diy · error · NotFoundException

Event type with slug ${body.eventTypeSlug} belonging to team

Error message

Event type with slug ${body.eventTypeSlug} belonging to team ${body.teamSlug} within organization ${body.organizationSlug} not found.

What it means

Thrown by handleEventTypeToBeBookedNotFound when the booking body contains teamSlug + eventTypeSlug + organizationSlug and no matching org-scoped team event type was resolved. NotFoundException (HTTP 404). This is the org-aware variant of error 323.

Source

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

  handleEventTypeToBeBookedNotFound(body: CreateBookingInput): never {
    if (body.username && body.eventTypeSlug && !body.organizationSlug) {
      throw new NotFoundException(
        `Event type with slug ${body.eventTypeSlug} belonging to user ${body.username} not found.`
      );
    }
    if (body.username && body.eventTypeSlug && body.organizationSlug) {
      throw new NotFoundException(
        `Event type with slug ${body.eventTypeSlug} belonging to user ${body.username} within organization ${body.organizationSlug} not found.`
      );
    }
    if (body.teamSlug && body.eventTypeSlug && !body.organizationSlug) {
      throw new NotFoundException(
        `Event type with slug ${body.eventTypeSlug} belonging to team ${body.teamSlug} not found.`
      );
    }
    if (body.teamSlug && body.eventTypeSlug && body.organizationSlug) {
      throw new NotFoundException(
        `Event type with slug ${body.eventTypeSlug} belonging to team ${body.teamSlug} within organization ${body.organizationSlug} not found.`
      );
    }
    throw new NotFoundException(`Event type with id ${body.eventTypeId} not found.`);
  }

  handleBookingError(error: unknown, bookingTeamEventType: boolean): never {
    const hostsUnavaile = "One of the hosts either already has booking at this time or is not available";

    if (error instanceof Error) {
      if (error.message === "no_available_users_found_error") {
        if (bookingTeamEventType) {
          throw new BadRequestException(hostsUnavaile);
        }
        throw new BadRequestException("User either already has booking at this time or is not available");
      } else if (error.message === "booking_time_out_of_bounds_error") {
        throw new BadRequestException(
          `The event type can't be booked at the "start" time provided. This could be because it's too soon (violating the minimum booking notice) or too far in the future (outside the event's scheduling window). Try fetching available slots first using the GET /v2/slots endpoint and then make a booking with "start" time equal to one of the available slots.`

View on GitHub (pinned to 176037d0af)

Solutions

  1. List org teams and their event types via the organization endpoint to confirm teamSlug + organizationSlug + eventTypeSlug match.
  2. Drop organizationSlug if the team is a standalone (non-org) team so the 323 branch applies.
  3. Re-fetch the current organizationSlug after any tenant restructure.
  4. Verify the event type still belongs to the team.

Example fix

// before
body: { teamSlug: 'sales', eventTypeSlug: 'demo', organizationSlug: 'wrong-org' }

// after
body: { teamSlug: 'sales', eventTypeSlug: 'demo', organizationSlug: 'acme' }
Defensive patterns

Strategy: validation

Validate before calling

const et = await api.get(`/v2/event-types?teamSlug=${body.teamSlug}&organizationSlug=${body.organizationSlug}`);
if (!et.data.some(e => e.slug === body.eventTypeSlug)) throw new Error('org team event type not found');

Type guard

const hasOrgTeamSlugCombo = (b: CreateBookingInput): boolean =>
  !!(b.teamSlug && b.eventTypeSlug && b.organizationSlug);

Try / catch

try { await api.post('/v2/bookings', body); }
catch (e) {
  if (e.response?.status === 404 && /team.*within organization/.test(e.response.data.message)) {
    /* re-resolve teamSlug and organizationSlug */
  } else throw e;
}

Prevention

When it happens

Trigger: POST /v2/bookings with { teamSlug, eventTypeSlug, organizationSlug } where the team is not in that organization, the slug is wrong, the event type belongs to a different team in the org, or the org/team combination does not exist.

Common situations: Team moved between orgs during a reorg; organizationSlug from a stale config; team is a non-org team but the caller passed an org slug; event type demoted from team to user scope.

Related errors


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