{"record":{"id":"85f226b90bf81d41","repo":"calcom/cal.diy","slug":"err-message-85f226","errorCode":null,"errorMessage":"${err.message}","messagePattern":"\\$\\{err\\.message\\}","errorType":"http","errorClass":"NotFoundException","httpStatus":404,"severity":"error","filePath":"apps/api/v2/src/platform/event-types/event-types_2024_04_15/controllers/event-types.controller.ts","lineNumber":154,"sourceCode":"\n      const event = await getPublicEvent(\n        username.toLowerCase(),\n        eventSlug,\n        queryParams.isTeamEvent,\n        orgSlug ?? null,\n        this.prismaReadService.prisma as unknown as PrismaClient,\n        // We should be fine allowing unpublished orgs events to be servable through platform because Platform access is behind license\n        // If there is ever a need to restrict this, we can introduce a new query param `fromRedirectOfNonOrgLink`\n        true\n      );\n\n      return {\n        data: event as unknown as PublicEventTypeOutput,\n        status: SUCCESS_STATUS,\n      };\n    } catch (err) {\n      if (err instanceof Error) {\n        throw new NotFoundException(err.message);\n      }\n    }\n    throw new InternalServerErrorException(\"Could not find public event.\");\n  }\n\n  @Get(\"/:username/public\")\n  async getPublicEventTypes(@Param(\"username\") username: string): Promise<GetEventTypesPublicOutput> {\n    const eventTypes = await this.eventTypesService.getEventTypesPublicByUsername(username);\n\n    return {\n      status: SUCCESS_STATUS,\n      data: eventTypes,\n    };\n  }\n\n  @Patch(\"/:eventTypeId\")\n  @Permissions([EVENT_TYPE_WRITE])\n  @UseGuards(ApiAuthGuard)","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/calcom/cal.diy/blob/176037d0afbe572f870a3c702985e7cd83fe6c0c/apps/api/v2/src/platform/event-types/event-types_2024_04_15/controllers/event-types.controller.ts#L136-L172","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Verify the username exists (e.g. via GET /v2/event-types/:username/public) before fetching a specific slug.","Confirm the eventSlug matches what is shown on the user's public profile; slugs change when the event type title is renamed.","Drop the `org` query param if the user is not in an organization, or supply the correct org slug.","If you suspect a server-side bug, retry once; if it persists, report it — the 404 may mask a 500."],"exampleFix":"// before\nconst evt = await api.get(`/v2/event-types/${username}/${slug}/public`);\n// after\nconst user = await api.get(`/v2/event-types/${username}/public`); // 404 here means bad username\nif (!user.data.some(e => e.slug === slug)) throw new Error(`slug ${slug} not public for ${username}`);\nconst evt = await api.get(`/v2/event-types/${username}/${slug}/public`);","handlingStrategy":"validation","validationCode":"// Verify the user has public event types before fetching a specific slug\nconst publicList = (await api.get(`/v2/event-types/${username}/public`)).data ?? [];\nif (!publicList.some((e) => e.slug === eventSlug)) {\n  throw new Error(`slug ${eventSlug} is not public for user ${username}`);\n}","typeGuard":"function isPublicEventTypeList(v: unknown): v is Array<{ slug: string }> {\n  return Array.isArray(v) && v.every((e) => typeof e === 'object' && e !== null && typeof (e as any).slug === 'string');\n}","tryCatchPattern":"try {\n  return await api.get(`/v2/event-types/${username}/${eventSlug}/public`);\n} catch (e) {\n  if (e.response?.status === 404) {\n    // username or slug wrong, OR server misclassified a 500 as 404 — retry once\n  } else throw e;\n}","preventionTips":["Fetch the public list first to confirm both username and slug before the specific GET.","Drop the `org` query param unless you know the user's org slug.","Remember that renaming an event type changes its slug — refresh cached slugs."],"tags":["nestjs","not-found","event-types","public-api","error-handling"],"backgroundTag":null,"analyzedSha":"176037d0afbe572f870a3c702985e7cd83fe6c0c","analyzedAt":"2026-08-12T19:12:41.464Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}