calcom/cal.diy · warning · NotFoundException
Event not found
Error message
Event not found
What it means
Thrown by getEventWithClient when calendar.events.get resolves with no data — the event id does not exist in the given calendar. Returns HTTP 404 via NotFoundException. The catch block also maps any Google 404 to this same message, so it covers both the no-data guard and the API-level not-found.
Source
Thrown at apps/api/v2/src/modules/cal-unified-calendars/services/google-calendar.service.ts:290
} catch (error) {
if (error instanceof HttpException) throw error;
throw this.mapGoogleApiError(error, "Failed to create calendar event");
}
}
private async getEventWithClient(
calendar: calendar_v3.Calendar,
calendarId: string,
eventId: string
): Promise<GoogleCalendarEventResponse> {
const effectiveCalendarId = calendarId || "primary";
try {
const event = await calendar.events.get({
calendarId: effectiveCalendarId,
eventId,
});
if (!event.data) {
throw new NotFoundException("Event not found");
}
return event.data as GoogleCalendarEventResponse;
} catch (error) {
if (error instanceof HttpException) throw error;
throw this.mapGoogleApiError(error, "Failed to retrieve event details");
}
}
private async updateEventWithClient(
calendar: calendar_v3.Calendar,
calendarId: string,
eventId: string,
updateData: UpdateUnifiedCalendarEventInput
): Promise<GoogleCalendarEventResponse> {
const effectiveCalendarId = calendarId || "primary";
const updatePayload = new GoogleCalendarEventInputPipe().transform(updateData);
try {
const event = await calendar.events.patch({View on GitHub (pinned to 176037d0af)
Solutions
- Verify the eventId still exists via Google Calendar UI or a list call.
- If deleted, remove the corresponding booking reference and stop polling.
- URL-encode the eventId (Google ids can contain characters that need encoding).
- For recurring events, use the instance id returned by the events.list, not the series master id, when fetching a specific occurrence.
Example fix
// before
const event = await googleCalendarService.getEventByConnectionId(userId, credId, calId, eventId);
// after
try {
const event = await googleCalendarService.getEventByConnectionId(userId, credId, calId, eventId);
} catch (e) {
if (e instanceof NotFoundException) {
// sync local cache: mark booking reference as cancelled
await bookingReferencesRepository.markRemoved(eventUid);
return null;
}
throw e;
} Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-flight: confirm event exists via a list call before fetching directly.
async function eventExists(calendar: calendar_v3.Calendar, calendarId: string, eventId: string): Promise<boolean> {
try {
await calendar.events.get({ calendarId, eventId });
return true;
} catch {
return false;
}
} Type guard
function isGoogleEventFound(r: { data?: unknown }): r is { data: Record<string, unknown> } {
return Boolean(r.data && typeof r.data === 'object' && 'id' in (r.data as object));
} Try / catch
try {
return await googleCalendarService.getEventByConnectionId(userId, credId, calId, evId);
} catch (e) {
if (e instanceof NotFoundException) {
// reconcile local state — the event is gone
await bookingReferencesRepository.markRemoved(eventUid);
return null;
}
throw e;
} Prevention
- URL-encode the eventId when building the request path.
- For recurring events, use the instance id returned by list, not the master id.
- Treat 404 as a signal to clean up local references rather than a hard failure.
When it happens
Trigger: Calling GET /v2/calendars/connections/{id}/events/{eventId} with an eventId that was deleted, never existed, or belongs to a different calendarId. Also when the event id has a leading whitespace or encoding issue.
Common situations: Event was deleted out of band (directly in Google Calendar UI); client cached an old event id; calendarId/eventId mix-up; recurring event instance id vs master id confusion.
Related errors
- Failed to update event
- Calendar connection not found
- Failed to create calendar event
- Team with id ${teamId} not found
- Event type with id ${eventTypeId} not found
AI-assisted analysis of calcom/cal.diy@176037d0af (2026-08-12).
Data as JSON: /api/errors/301a6f4a50d3004e.
Report an issue: GitHub.