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 EventTypeOwnershipGuard.canActivate when eventTypesService.getUserEventType(user.id, eventTypeId) returns a falsy result. getUserEventType scopes the query to the requesting user, so this fires both when the event type does not exist AND when it exists but is not owned by the user. Raised as NotFoundException (HTTP 404) to avoid leaking existence of other users' resources (the comment notes this mirrors EventTypesService behavior).

Source

Thrown at apps/api/v2/src/modules/event-types/guards/event-type-ownership.guard.ts:37

    const user = request.user as ApiAuthGuardUser | undefined;
    const eventTypeIdParam = request.params?.eventTypeId;

    if (!user) {
      throw new ForbiddenException("EventTypeOwnershipGuard - No user associated with the request.");
    }

    if (!eventTypeIdParam) {
      throw new BadRequestException("Missing eventTypeId param.");
    }

    const eventTypeId = Number(eventTypeIdParam);
    if (!Number.isInteger(eventTypeId) || eventTypeId <= 0) {
      throw new BadRequestException("Invalid eventTypeId param.");
    }
    const eventType = await this.eventTypesService.getUserEventType(user.id, eventTypeId);
    if (!eventType) {
      // Mirrors EventTypesService behavior: NotFound when not owned or not present
      throw new NotFoundException(`Event type with id ${eventTypeId} not found`);
    }

    return true;
  }
}

View on GitHub (pinned to 176037d0af)

Solutions

  1. Re-fetch the user's event types to obtain a current id they own.
  2. Confirm the authenticated user is the owner (or has team membership granting access) of that event type.
  3. Handle 404 gracefully in the client by refreshing the list and clearing stale references.
Defensive patterns

Strategy: try-catch

Validate before calling

const owned = await eventTypesService.getUserEventType(user.id, eventTypeId);
if (!owned) {
  // refresh list, pick a valid id, or return 404 early
}

Try / catch

try {
  await eventTypesController.update(eventTypeId, body);
} catch (e) {
  if (e instanceof NotFoundException && /not found/.test(e.message)) {
    // refresh the list, drop stale id
  }
  throw e;
}

Prevention

When it happens

Trigger: Client requests, updates, or deletes an eventTypeId that does not exist or belongs to a different user/owner. The ownership-scoped query returns nothing and the guard throws before the handler runs.

Common situations: Stale id from a deleted event type; cross-tenant access attempt; user switched accounts and the id belongs to the previous account; frontend cached an id after it was reassigned.

Related errors


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