calcom/cal.diy · error · BadRequestException
Invalid seatUid: this seat does not exist or has already bee
Error message
Invalid seatUid: this seat does not exist or has already been cancelled.
What it means
Thrown by cancelBooking when the request body is identified as a seated-cancellation (isCancelSeatedBody true) but the referenced seatUid does not resolve to a seat via bookingSeatRepository.getByReferenceUid. BadRequestException (HTTP 400).
Source
Thrown at apps/api/v2/src/platform/bookings/2024-08-13/services/bookings.service.ts:904
return isOrgAdmin;
}
isRescheduleSeatedBody(body: RescheduleBookingInput): body is RescheduleSeatedBookingInput_2024_08_13 {
return "seatUid" in body;
}
async cancelBooking(
request: Request,
bookingUid: string,
body: CancelBookingInput,
authUser: AuthOptionalUser
) {
if (this.inputService.isCancelSeatedBody(body)) {
const seat = await this.bookingSeatRepository.getByReferenceUid(body.seatUid);
if (!seat) {
throw new BadRequestException(
"Invalid seatUid: this seat does not exist or has already been cancelled."
);
}
if (seat && bookingUid !== seat.booking.uid) {
throw new BadRequestException("Invalid seatUid: this seat does not belong to this booking.");
}
}
const bookingRequest = await this.inputService.createCancelBookingRequest(request, bookingUid, body);
const res = await handleCancelBooking({
bookingData: bookingRequest.body,
userId: bookingRequest.userId,
userUuid: authUser?.uuid,
actionSource: "API_V2",
arePlatformEmailsEnabled: bookingRequest.arePlatformEmailsEnabled,
platformClientId: bookingRequest.platformClientId,
platformCancelUrl: bookingRequest.platformCancelUrl,View on GitHub (pinned to 176037d0af)
Solutions
- Verify the seatUid is active by fetching the parent booking and inspecting its seats before cancelling.
- Guard against double-cancel: track local seat state and skip if already cancelled.
- Ensure the value is the seat reference uid, not the booking uid.
Example fix
// before
await client.delete(`/v2/bookings/${uid}`, { data: { seatUid: bookingUid } });
// after
await client.delete(`/v2/bookings/${uid}`, { data: { seatUid: activeSeatUid } }); Defensive patterns
Strategy: validation
Validate before calling
const booking = await client.get(`/v2/bookings/${uid}`);
const seatActive = booking.seats?.some(s => s.seatUid === body.seatUid);
if (!seatActive) throw new Error('seatUid is not active'); Type guard
function isSeatActive(seatUid: string, seats: { seatUid: string; cancelled?: boolean }[]): boolean {
return seats.some(s => s.seatUid === seatUid && !s.cancelled);
} Try / catch
try { await client.delete(`/v2/bookings/${uid}`, { data: { seatUid } }); }
catch (e) {
if (e.status === 400 && /does not exist or has already been cancelled/i.test(e.message)) { /* seat already gone; treat as success */ }
else throw e;
} Prevention
- Track local seat state to avoid double-cancel
- Fetch booking seats before cancelling
- Treat 'already cancelled' as idempotent success
When it happens
Trigger: Cancelling a single seat with body.seatUid set, where the seatUid does not exist or has already been cancelled (seats are deleted on cancel).
Common situations: Double-cancelling a seat; passing the booking uid as seatUid; seatUid from a different booking or environment.
Related errors
- Invalid seatUid: this seat does not belong to this booking.
- Please provide booking uid instead of booking id.
- Team with slug ${body.teamSlug} not found
- Missing attendee phone number - it is required by the event
- Missing required booking field response: ${eventTypeBookingF
AI-assisted analysis of calcom/cal.diy@176037d0af (2026-08-12).
Data as JSON: /api/errors/1caaf0a51dba4d3f.
Report an issue: GitHub.