{"record":{"id":"e86d990c3e4e4d4d","repo":"calcom/cal.diy","slug":"could-not-find-public-event","errorCode":null,"errorMessage":"Could not find public event.","messagePattern":"Could not find public event\\.","errorType":"http","errorClass":"InternalServerErrorException","httpStatus":500,"severity":"critical","filePath":"apps/api/v2/src/platform/event-types/event-types_2024_04_15/controllers/event-types.controller.ts","lineNumber":157,"sourceCode":"        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)\n  @HttpCode(HttpStatus.OK)\n  async updateEventType(\n    @Param() params: EventTypeIdParams_2024_04_15,","sourceCodeStart":139,"sourceCodeEnd":175,"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#L139-L175","documentation":"Thrown by EventTypesController_2024_04_15.getPublicEventType as InternalServerErrorException (HTTP 500) when the catch block completes without throwing — i.e. the caught value is not an Error instance. Because the catch only handles Error subclasses, a non-Error throw (string, plain object) falls through and execution reaches the trailing `throw new InternalServerErrorException`.","triggerScenarios":"getPublicEvent (or its dependencies: organizationsRepository.findTeamIdAndSlugFromClientId, the Prisma read service) throwing a non-Error value; a Promise rejection with a primitive; an unhandled edge case in team/org resolution that rejects with a plain object.","commonSituations":"A library used by getPublicEvent throwing a string error; a stale build where a dependency was partially upgraded; a mocked test that rejects with a non-Error. This is a server defect, not a client-correctable condition.","solutions":["Retry the request once to rule out a transient cause; if it persists, escalate to server logs.","Search getPublicEvent and its callees for `throw` of non-Error values and normalize them to Error.","Add a default branch in the catch that logs the raw value (typeof + JSON) before falling through.","If you control the server, refactor the catch to handle unknown values explicitly instead of relying on the fallthrough."],"exampleFix":"// before\n} catch (err) {\n  if (err instanceof Error) throw new NotFoundException(err.message);\n}\nthrow new InternalServerErrorException('Could not find public event.');\n// after\n} catch (err) {\n  if (err instanceof HttpException) throw err;\n  if (err instanceof Error) throw new NotFoundException(err.message);\n  logger.error({ err }, 'Non-Error thrown in getPublicEventType');\n}\nthrow new InternalServerErrorException('Could not find public event.');","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  return await api.get(`/v2/event-types/${username}/${slug}/public`);\n} catch (e) {\n  if (e.response?.status === 500) {\n    // retry once; if it persists, the server caught a non-Error — escalate\n    return await api.get(`/v2/event-types/${username}/${slug}/public`);\n  }\n  throw e;\n}","preventionTips":["Escalate persistent 500s to the server team — the catch fallthrough is a defect.","In your own code, never throw non-Error values; always use `throw new Error(...)`.","Add server-side logging that captures typeof + value of any caught non-Error."],"tags":["nestjs","internal-server-error","event-types","defensive-catch","error-handling"],"backgroundTag":null,"analyzedSha":"176037d0afbe572f870a3c702985e7cd83fe6c0c","analyzedAt":"2026-08-12T19:12:41.464Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}