calcom/cal.diy · error · NotFoundException

Booking with uid=${bookingUid} was not found in the database

Error message

Booking with uid=${bookingUid} was not found in the database

What it means

Thrown by CalVideoService.getRecordings when getByUidWithBookingReference(bookingUid) returns null. NestJS NotFoundException (HTTP 404). The booking uid passed to the recordings endpoint does not exist, so recordings cannot be looked up.

Source

Thrown at apps/api/v2/src/platform/bookings/2024-08-13/services/cal-video.service.ts:31

@Injectable()
export class CalVideoService {
  private readonly logger = new Logger("CalVideoService");
  constructor(
    private readonly bookingsRepository: BookingsRepository_2024_08_13,
    private readonly calVideoOutputService: CalVideoOutputService
  ) {}

  private getVideoSessionsRoomName(references?: Array<{ type: string; meetingId?: string | null }>) {
    return (
      references?.filter((reference) => reference.type === CAL_VIDEO_TYPE)?.pop()?.meetingId ??
      undefined
    );
  }

  async getRecordings(bookingUid: string) {
    const booking = await this.bookingsRepository.getByUidWithBookingReference(bookingUid);
    if (!booking) {
      throw new NotFoundException(`Booking with uid=${bookingUid} was not found in the database`);
    }

    const roomName = this.getVideoSessionsRoomName(booking.references);
    if (!roomName) {
      throw new NotFoundException(`No Cal Video reference found with booking uid ${bookingUid}`);
    }

    const recordings = await getRecordingsOfCalVideoByRoomName(roomName);

    if (!recordings || !("data" in recordings)) return [];

    const recordingWithDownloadLink = recordings.data.map((recording) => {
      return getDownloadLinkOfCalVideoByRecordingId(recording.id)
        .then((res: { download_link: string } | undefined) => ({
          id: recording.id,
          roomName: recording.room_name,
          startTs: recording.start_ts,
          status: recording.status,

View on GitHub (pinned to 176037d0af)

Solutions

  1. Verify the booking with GET /v2/bookings/{uid} before requesting recordings.
  2. Stop polling once a booking returns 404.
  3. Confirm the uid and environment.
  4. Treat 404 as terminal in recording-fetch workflows.

Example fix

// before
const recs = await apiClient.get(`/v2/bookings/${uid}/recordings`);

// after
const booking = await apiClient.get(`/v2/bookings/${uid}`).then(r => r.data).catch(() => null);
if (!booking) return []; // booking gone - no recordings
const recs = await apiClient.get(`/v2/bookings/${uid}/recordings`);
Defensive patterns

Strategy: validation

Validate before calling

const booking = await apiClient.get(`/v2/bookings/${uid}`).then(r => r.data).catch(() => null);
if (!booking) { console.warn(`Booking ${uid} missing - no recordings`); return []; }

Type guard

function isBookingMissing(err: unknown): boolean {
  return typeof err === 'object' && err !== null &&
    (err as any).response?.status === 404 &&
    /was not found in the database/i.test((err as any).response?.data?.message ?? '');
}

Try / catch

try {
  return await apiClient.get(`/v2/bookings/${uid}/recordings`).then(r => r.data);
} catch (err) {
  if (err.response?.status === 404 && /was not found in the database/i.test(err.response?.data?.message ?? '')) return [];
  throw err;
}

Prevention

When it happens

Trigger: GET /v2/bookings/{uid}/recordings with a non-existent bookingUid; booking deleted before the call; uid from the wrong environment.

Common situations: Polling for recordings on a booking that was cancelled/removed; stale uid in client state; copy errors.

Related errors


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