calcom/cal.diy · error · NotFoundException
Event type with id ${eventTypeId} not found
Error message
Event type with id ${eventTypeId} not found What it means
Thrown by EventTypesAtomService.getUserEventType when getEventTypeById returns null for the given eventTypeId. The getEventTypeById function (from @calcom/platform-libraries) performs a complex query that filters by the user's organization, userId, and whether the user is an organization admin. If no event type matches all criteria, it returns null and this exception fires with NotFoundException (HTTP 404).
Source
Thrown at apps/api/v2/src/modules/atoms/services/event-types-atom.service.ts:106
async getUserEventType(user: UserWithProfile, eventTypeId: number) {
const organizationId = this.usersService.getUserMainOrgId(user);
const isUserOrganizationAdmin = organizationId
? await this.membershipsRepository.isUserOrganizationAdmin(user.id, organizationId)
: false;
const eventType = await getEventTypeById({
currentOrganizationId: this.usersService.getUserMainOrgId(user),
eventTypeId,
userId: user.id,
userLocale: user.locale ?? "en",
prisma: this.dbRead.prisma as unknown as PrismaClient,
isUserOrganizationAdmin,
isTrpcCall: true,
});
if (!eventType) {
throw new NotFoundException(`Event type with id ${eventTypeId} not found`);
}
if (!isUserOrganizationAdmin) {
if (eventType?.team?.id) {
await this.checkTeamOwnsEventType(user.id, eventType.eventType.id, eventType.team.id);
} else {
this.eventTypeService.checkUserOwnsEventType(user.id, eventType.eventType);
}
}
// note (Lauris): don't show platform owner as one of the people that can be assigned to managed team event type
const onlyManagedTeamMembers = eventType.teamMembers.filter((user) => user.isPlatformManaged);
eventType.teamMembers = onlyManagedTeamMembers;
return eventType;
}
async getUserEventTypes(userId: number) {View on GitHub (pinned to 176037d0af)
Solutions
- Verify the eventTypeId belongs to the authenticated user or a team they are a member of.
- If the user is in an organization, confirm they still have access (check membership and organization assignment).
- Use GET /v2/event-types to list the user's accessible event types and confirm the ID is present.
- For team event types, ensure the user has an accepted membership with ADMIN or OWNER role, or is an organization admin.
Example fix
// before: using a hardcoded eventTypeId
const eventType = await api.get(`/v2/event-types/999`);
// after: verify ownership before accessing
const myEventTypes = await api.get('/v2/event-types');
const valid = myEventTypes.find(et => et.id === targetEventTypeId);
if (!valid) {
throw new Error(`Event type ${targetEventTypeId} not found or not accessible by this user.`);
}
const eventType = await api.get(`/v2/event-types/${targetEventTypeId}`); Defensive patterns
Strategy: validation
Validate before calling
// Verify the event type is accessible by this user before fetching details
const verifyEventTypeAccess = async (api: ApiClient, eventTypeId: number): Promise<boolean> => {
const eventTypes = await api.get('/v2/event-types');
return eventTypes.some((et: { id: number }) => et.id === eventTypeId);
};
if (!await verifyEventTypeAccess(api, targetId)) {
throw new Error(`Event type ${targetId} is not accessible by this user.`);
} Try / catch
// Handle 404 on event-type fetch
try {
const eventType = await api.get(`/v2/event-types/${id}`);
return eventType;
} catch (err: any) {
if (err?.response?.status === 404) {
return null; // signal not-found to caller
}
throw err;
} Prevention
- Before accessing a specific event type by ID, verify it appears in the user's event-type list.
- Handle event-type deletions in the UI by refreshing the list when a 404 is received.
- For team event types, verify the user's membership role is ADMIN or OWNER before accessing.
When it happens
Trigger: Calling GET /v2/event-types/:id with an eventTypeId that doesn't exist, belongs to a different user, or is in an organization the caller doesn't belong to. The event type is a team event and the user is not a member of that team. The currentOrganizationId doesn't match the event type's organization.
Common situations: Using an eventTypeId from a different user's account. Event type was deleted or archived. Organization membership changed (user removed from org) making previously accessible event types invisible. isUserOrganizationAdmin is false and the event type is in an org the user belongs to but doesn't own.
Related errors
- Team with id ${teamId} not found
- Access denied. Either the team with ID=${teamId} does not ow
- Event type with uid ${uid} not found
- No users found or no team present for event type with uid ${
- Event type with slug ${eventSlug} not found
AI-assisted analysis of calcom/cal.diy@176037d0af (2026-08-12).
Data as JSON: /api/errors/1830323bfca4c7c9.
Report an issue: GitHub.