calcom/cal.diy · error · NotFoundException

${err.message}

Error message

${err.message}

What it means

Thrown by EventTypesController_2024_04_15.getPublicEventType when getPublicEvent throws any Error. The catch block wraps every Error as a NotFoundException (HTTP 404), regardless of the actual cause. This means a genuine server error inside getPublicEvent (e.g. a malformed query) is misreported as 'not found', conflating missing data with internal failures.

Source

Thrown at apps/api/v2/src/platform/event-types/event-types_2024_04_15/controllers/event-types.controller.ts:154

      const event = await getPublicEvent(
        username.toLowerCase(),
        eventSlug,
        queryParams.isTeamEvent,
        orgSlug ?? null,
        this.prismaReadService.prisma as unknown as PrismaClient,
        // We should be fine allowing unpublished orgs events to be servable through platform because Platform access is behind license
        // If there is ever a need to restrict this, we can introduce a new query param `fromRedirectOfNonOrgLink`
        true
      );

      return {
        data: event as unknown as PublicEventTypeOutput,
        status: SUCCESS_STATUS,
      };
    } catch (err) {
      if (err instanceof Error) {
        throw new NotFoundException(err.message);
      }
    }
    throw new InternalServerErrorException("Could not find public event.");
  }

  @Get("/:username/public")
  async getPublicEventTypes(@Param("username") username: string): Promise<GetEventTypesPublicOutput> {
    const eventTypes = await this.eventTypesService.getEventTypesPublicByUsername(username);

    return {
      status: SUCCESS_STATUS,
      data: eventTypes,
    };
  }

  @Patch("/:eventTypeId")
  @Permissions([EVENT_TYPE_WRITE])
  @UseGuards(ApiAuthGuard)

View on GitHub (pinned to 176037d0af)

Solutions

  1. Verify the username exists (e.g. via GET /v2/event-types/:username/public) before fetching a specific slug.
  2. Confirm the eventSlug matches what is shown on the user's public profile; slugs change when the event type title is renamed.
  3. Drop the `org` query param if the user is not in an organization, or supply the correct org slug.
  4. If you suspect a server-side bug, retry once; if it persists, report it — the 404 may mask a 500.

Example fix

// before
const evt = await api.get(`/v2/event-types/${username}/${slug}/public`);
// after
const user = await api.get(`/v2/event-types/${username}/public`); // 404 here means bad username
if (!user.data.some(e => e.slug === slug)) throw new Error(`slug ${slug} not public for ${username}`);
const evt = await api.get(`/v2/event-types/${username}/${slug}/public`);
Defensive patterns

Strategy: validation

Validate before calling

// Verify the user has public event types before fetching a specific slug
const publicList = (await api.get(`/v2/event-types/${username}/public`)).data ?? [];
if (!publicList.some((e) => e.slug === eventSlug)) {
  throw new Error(`slug ${eventSlug} is not public for user ${username}`);
}

Type guard

function isPublicEventTypeList(v: unknown): v is Array<{ slug: string }> {
  return Array.isArray(v) && v.every((e) => typeof e === 'object' && e !== null && typeof (e as any).slug === 'string');
}

Try / catch

try {
  return await api.get(`/v2/event-types/${username}/${eventSlug}/public`);
} catch (e) {
  if (e.response?.status === 404) {
    // username or slug wrong, OR server misclassified a 500 as 404 — retry once
  } else throw e;
}

Prevention

When it happens

Trigger: GET /v2/event-types/:username/:eventSlug/public where the username does not exist; the slug does not exist for that user; the org query param references a non-existent org; getPublicEvent's internal logic throws on an edge case (e.g. team event resolution).

Common situations: Public scheduling page for a renamed/deleted user; slug changed after an event-type update; org slug typo in the `org` query param; requesting a hidden event type as an anonymous user; a transient DB read failure misclassified as 404.

Related errors


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