{"record":{"id":"adba61fc82aa38a4","repo":"calcom/cal.diy","slug":"booking-of-id-bookingid-does-not-exist-or-does","errorCode":null,"errorMessage":"Booking of id ${bookingId} does not exist or does not contain daily video as location","messagePattern":"Booking of id (.+?) does not exist or does not contain daily video as location","errorType":"http","errorClass":"HttpError","httpStatus":404,"severity":"error","filePath":"apps/web/lib/daily-webhook/getBooking.ts","lineNumber":21,"sourceCode":"import logger from \"@calcom/lib/logger\";\nimport { safeStringify } from \"@calcom/lib/safeStringify\";\nimport prisma from \"@calcom/prisma\";\n\nconst log = logger.getSubLogger({ prefix: [\"daily-video-webhook-handler\"] });\n\nexport const getBooking = async (bookingId: number) => {\n  const bookingRepository = new BookingRepository(prisma);\n  const booking = await bookingRepository.findByIdWithUserAndEventType(bookingId);\n\n  if (!booking) {\n    log.error(\n      \"Couldn't find Booking Id:\",\n      safeStringify({\n        bookingId,\n      })\n    );\n\n    throw new HttpError({\n      message: `Booking of id ${bookingId} does not exist or does not contain daily video as location`,\n      statusCode: 404,\n    });\n  }\n  return booking;\n};\n\nexport type getBookingResponse = Awaited<ReturnType<typeof getBooking>>;\n","sourceCodeStart":3,"sourceCodeEnd":30,"githubUrl":"https://github.com/calcom/cal.diy/blob/176037d0afbe572f870a3c702985e7cd83fe6c0c/apps/web/lib/daily-webhook/getBooking.ts#L3-L30","documentation":"Thrown by getBooking in the daily-webhook handler (HttpError, HTTP 404) when BookingRepository.findByIdWithUserAndEventType(bookingId) returns null. It means no booking exists for that ID, or the booking does not use Daily video as its location. The handler logs the missing bookingId via safeStringify before throwing.","triggerScenarios":"A Daily.co webhook fires for a bookingId that has no matching row: deleted/cancelled booking, test webhook with a fake ID, webhook arriving before the booking was committed, or a booking whose location is not daily video.","commonSituations":"Webhook retry arriving after booking deletion, staging webhook pointing at production IDs, race between booking creation and webhook delivery, non-video bookings erroneously routed to the daily webhook.","solutions":["Make the webhook receiver idempotent: treat a 404 'does not exist' as a no-op and return 2xx to stop Daily retries.","Verify the booking's location is daily video before subscribing the webhook to that booking.","If the race is real (webhook before commit), requeue with backoff and retry until the booking appears, with a max-attempt cap."],"exampleFix":"// before\nconst booking = await getBooking(bookingId); // throws 404\n\n// after\ntry {\n  const booking = await getBooking(bookingId);\n  processWebhook(booking);\n} catch (e) {\n  if (e instanceof HttpError && e.statusCode === 404) {\n    return Response.json({ ok: true, ignored: 'booking not found' }); // stop retries\n  }\n  throw e;\n}","handlingStrategy":"try-catch","validationCode":"// Idempotent webhook receiver: short-circuit unknown bookings\nconst booking = await api.getBooking(bookingId).catch(() => null);\nif (!booking) {\n  return Response.json({ ok: true, ignored: 'booking not found' });\n}","typeGuard":"function isDailyVideoBooking(b: unknown): b is { id: number; location: string } {\n  return !!b && typeof b === 'object' &&\n    typeof (b as any).id === 'number' &&\n    typeof (b as any).location === 'string' &&\n    (b as any).location.includes('integrations:daily');\n}","tryCatchPattern":"try {\n  const booking = await getBooking(bookingId);\n  await processWebhook(booking);\n} catch (e) {\n  if (e instanceof HttpError && e.statusCode === 404) {\n    return Response.json({ ok: true, ignored: 'not found' }); // stop Daily retries\n  }\n  throw e;\n}","preventionTips":["Make webhook handlers idempotent and never error out for missing bookings.","Confirm the booking location is daily video before subscribing webhooks.","Cap retries for the booking-not-yet-committed race; otherwise accept-and-ignore."],"tags":["booking","daily","webhook","video","not-found","idempotency"],"backgroundTag":null,"analyzedSha":"176037d0afbe572f870a3c702985e7cd83fe6c0c","analyzedAt":"2026-08-12T19:12:41.464Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}