calcom/cal.diy · critical · InternalServerErrorException

Could not find public event.

Error message

Could not find public event.

What it means

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`.

Source

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

        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)
  @HttpCode(HttpStatus.OK)
  async updateEventType(
    @Param() params: EventTypeIdParams_2024_04_15,

View on GitHub (pinned to 176037d0af)

Solutions

  1. Retry the request once to rule out a transient cause; if it persists, escalate to server logs.
  2. Search getPublicEvent and its callees for `throw` of non-Error values and normalize them to Error.
  3. Add a default branch in the catch that logs the raw value (typeof + JSON) before falling through.
  4. If you control the server, refactor the catch to handle unknown values explicitly instead of relying on the fallthrough.

Example fix

// before
} catch (err) {
  if (err instanceof Error) throw new NotFoundException(err.message);
}
throw new InternalServerErrorException('Could not find public event.');
// after
} catch (err) {
  if (err instanceof HttpException) throw err;
  if (err instanceof Error) throw new NotFoundException(err.message);
  logger.error({ err }, 'Non-Error thrown in getPublicEventType');
}
throw new InternalServerErrorException('Could not find public event.');
Defensive patterns

Strategy: retry

Try / catch

try {
  return await api.get(`/v2/event-types/${username}/${slug}/public`);
} catch (e) {
  if (e.response?.status === 500) {
    // retry once; if it persists, the server caught a non-Error — escalate
    return await api.get(`/v2/event-types/${username}/${slug}/public`);
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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