{"record":{"id":"9d180f0d8f871c41","repo":"calcom/cal.diy","slug":"booking-id-is-required","errorCode":null,"errorMessage":"Booking ID is required.","messagePattern":"Booking ID is required\\.","errorType":"http","errorClass":"NotFoundException","httpStatus":404,"severity":"warning","filePath":"apps/api/v2/src/platform/bookings/2024-04-15/controllers/bookings.controller.ts","lineNumber":285,"sourceCode":"          platformClientId: bookingRequest.platformClientId,\n          platformCancelUrl: bookingRequest.platformCancelUrl,\n          platformRescheduleUrl: bookingRequest.platformRescheduleUrl,\n          platformBookingUrl: bookingRequest.platformBookingUrl,\n          actionSource: \"API_V2\",\n        });\n        return {\n          status: SUCCESS_STATUS,\n          data: {\n            bookingId: res.bookingId,\n            bookingUid: res.bookingUid,\n            onlyRemovedAttendee: res.onlyRemovedAttendee,\n          },\n        };\n      } catch (err) {\n        this.handleBookingErrors(err);\n      }\n    } else {\n      throw new NotFoundException(\"Booking ID is required.\");\n    }\n    throw new InternalServerErrorException(\"Could not cancel booking.\");\n  }\n\n  @Post(\"/:bookingUid/mark-no-show\")\n  @Permissions([BOOKING_WRITE])\n  @UseGuards(ApiAuthGuard)\n  async markNoShow(\n    @GetUser() user: UserWithProfile,\n    @Body() body: MarkNoShowInput_2024_04_15,\n    @Param(\"bookingUid\") bookingUid: string\n  ): Promise<MarkNoShowOutput_2024_04_15> {\n    try {\n      const markNoShowResponse = await handleMarkNoShow({\n        bookingUid: bookingUid,\n        attendees: body.attendees,\n        noShowHost: body.noShowHost,\n        userId: user.id,","sourceCodeStart":267,"sourceCodeEnd":303,"githubUrl":"https://github.com/calcom/cal.diy/blob/176037d0afbe572f870a3c702985e7cd83fe6c0c/apps/api/v2/src/platform/bookings/2024-04-15/controllers/bookings.controller.ts#L267-L303","documentation":"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.","triggerScenarios":"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.","commonSituations":"Misconfigured route, proxy URL-rewriting that drops the segment, or unit tests calling the method with '' or undefined.","solutions":["Ensure the request URL contains a non-empty :bookingUid segment.","Add an upstream route constraint that rejects empty params.","In direct/test invocations, pass a valid uid."],"exampleFix":"// before\nawait api.cancelBooking('');\n// after\nif (!bookingUid) throw new Error('bookingUid required');\nawait api.cancelBooking(bookingUid);","handlingStrategy":"validation","validationCode":"function assertBookingUidPresent(uid: unknown): asserts uid is string {\n  if (typeof uid !== 'string' || uid.trim() === '') {\n    throw new Error('bookingUid is required');\n  }\n}\nassertBookingUidPresent(bookingUid);","typeGuard":"const isNonEmptyUid = (v: unknown): v is string =>\n  typeof v === 'string' && v.trim().length > 0;","tryCatchPattern":"try { await api.cancelBooking(uid); }\ncatch (e) { if (e.status === 404 && /Booking ID is required/.test(e.message)) { /* fix URL and retry */ } else throw e; }","preventionTips":["Ensure the request URL contains a non-empty :bookingUid.","Add a route constraint that rejects empty params at the gateway.","Never call controller methods directly without a valid uid in tests."],"tags":["bookings","not-found","unreachable","routing","cancel"],"backgroundTag":null,"analyzedSha":"176037d0afbe572f870a3c702985e7cd83fe6c0c","analyzedAt":"2026-08-12T19:12:41.464Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}