calcom/cal.diy · warning · NotFoundException

Booking ID is required.

Error message

Booking ID is required.

What it means

cancelBooking has an else branch that throws NotFoundException (HTTP 404) 'Booking ID is required.' when bookingUid is falsy. Because :bookingUid is a required route param this branch is effectively unreachable in normal routing; reaching it implies the param arrived empty (e.g. empty string accepted by routing) or the code path was reused outside the route.

Source

Thrown at apps/api/v2/src/platform/bookings/2024-04-15/controllers/bookings.controller.ts:285

          platformClientId: bookingRequest.platformClientId,
          platformCancelUrl: bookingRequest.platformCancelUrl,
          platformRescheduleUrl: bookingRequest.platformRescheduleUrl,
          platformBookingUrl: bookingRequest.platformBookingUrl,
          actionSource: "API_V2",
        });
        return {
          status: SUCCESS_STATUS,
          data: {
            bookingId: res.bookingId,
            bookingUid: res.bookingUid,
            onlyRemovedAttendee: res.onlyRemovedAttendee,
          },
        };
      } catch (err) {
        this.handleBookingErrors(err);
      }
    } else {
      throw new NotFoundException("Booking ID is required.");
    }
    throw new InternalServerErrorException("Could not cancel booking.");
  }

  @Post("/:bookingUid/mark-no-show")
  @Permissions([BOOKING_WRITE])
  @UseGuards(ApiAuthGuard)
  async markNoShow(
    @GetUser() user: UserWithProfile,
    @Body() body: MarkNoShowInput_2024_04_15,
    @Param("bookingUid") bookingUid: string
  ): Promise<MarkNoShowOutput_2024_04_15> {
    try {
      const markNoShowResponse = await handleMarkNoShow({
        bookingUid: bookingUid,
        attendees: body.attendees,
        noShowHost: body.noShowHost,
        userId: user.id,

View on GitHub (pinned to 176037d0af)

Solutions

  1. Ensure the request URL contains a non-empty :bookingUid segment.
  2. Add an upstream route constraint that rejects empty params.
  3. In direct/test invocations, pass a valid uid.

Example fix

// before
await api.cancelBooking('');
// after
if (!bookingUid) throw new Error('bookingUid required');
await api.cancelBooking(bookingUid);
Defensive patterns

Strategy: validation

Validate before calling

function assertBookingUidPresent(uid: unknown): asserts uid is string {
  if (typeof uid !== 'string' || uid.trim() === '') {
    throw new Error('bookingUid is required');
  }
}
assertBookingUidPresent(bookingUid);

Type guard

const isNonEmptyUid = (v: unknown): v is string =>
  typeof v === 'string' && v.trim().length > 0;

Try / catch

try { await api.cancelBooking(uid); }
catch (e) { if (e.status === 404 && /Booking ID is required/.test(e.message)) { /* fix URL and retry */ } else throw e; }

Prevention

When it happens

Trigger: The route matched with an empty/whitespace bookingUid such that the earlier isUidNumber check was false but the value was still falsy; or the controller method is invoked directly with no uid.

Common situations: Misconfigured route, proxy URL-rewriting that drops the segment, or unit tests calling the method with '' or undefined.

Related errors


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