calcom/cal.diy · error · NotFoundException
Event type with slug ${body.eventTypeSlug} belonging to user
Error message
Event type with slug ${body.eventTypeSlug} belonging to user ${body.username} within organization ${body.organizationSlug} not found. What it means
Thrown by handleEventTypeToBeBookedNotFound when the booking body contains username + eventTypeSlug + organizationSlug and no matching org-scoped user event type was found. NotFoundException (HTTP 404). This is the organization-aware variant of error 321 — the resolver checked within the org namespace and missed.
Source
Thrown at apps/api/v2/src/platform/bookings/2024-08-13/services/errors.service.ts:17
import { BadRequestException, Injectable, NotFoundException } from "@nestjs/common";
import { Logger } from "@nestjs/common";
import { CreateBookingInput } from "@calcom/platform-types";
@Injectable()
export class ErrorsBookingsService_2024_08_13 {
private readonly logger = new Logger("ErrorsBookingsService_2024_08_13");
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";View on GitHub (pinned to 176037d0af)
Solutions
- Confirm membership: GET /v2/organizations/{organizationSlug}/memberships for the user before booking.
- Validate the event type exists within the org via the org-scoped event-types endpoint.
- Drop organizationSlug if the event type is actually a non-org user event type (lets the 321 branch resolve).
- Switch to teamSlug if the event type is now team-owned within the org.
Example fix
// before
body: { username: 'alice', eventTypeSlug: 'intro', organizationSlug: 'old-co' }
// after
body: { username: 'alice', eventTypeSlug: 'intro', organizationSlug: 'new-co' } Defensive patterns
Strategy: validation
Validate before calling
const { username, eventTypeSlug, organizationSlug } = body;
if (username && eventTypeSlug && organizationSlug) {
const memberships = await api.get(`/v2/organizations/${organizationSlug}/memberships`);
if (!memberships.data.some(m => m.user.username === username)) throw new Error('user not in org');
} Type guard
const hasOrgUserSlugCombo = (b: CreateBookingInput): boolean => !!(b.username && b.eventTypeSlug && b.organizationSlug);
Try / catch
try { await api.post('/v2/bookings', body); }
catch (e) {
if (e.response?.status === 404 && /within organization/.test(e.response.data.message)) {
/* drop organizationSlug or correct it, then retry */
} else throw e;
} Prevention
- Confirm the user is a member of the organization before including organizationSlug.
- Refresh organizationSlug after tenant restructures.
- Fall back to the non-org branch if the event type is not org-scoped.
When it happens
Trigger: POST /v2/bookings with { username, eventTypeSlug, organizationSlug } where the user is not a member of that organization, the slug exists only outside the org, the org slug is wrong, or the event type is org-level but belongs to a different user within the org.
Common situations: User was removed from the organization but the client still caches the old org context; wrong organizationSlug after a tenant rename; event type was migrated to a team event type and is no longer user-scoped; cross-org confusion in multi-tenant integrations.
Related errors
- Event type with slug ${body.eventTypeSlug} belonging to team
- Event type with slug ${body.eventTypeSlug} belonging to user
- Event type with slug ${body.eventTypeSlug} belonging to team
- Event type with id ${body.eventTypeId} not found.
- Event type with id=${inputBooking.eventTypeId} is not a recu
AI-assisted analysis of calcom/cal.diy@176037d0af (2026-08-12).
Data as JSON: /api/errors/d6e14ba240ab773c.
Report an issue: GitHub.