{"record":{"id":"c3b0082ff5d92bcd","repo":"calcom/cal.diy","slug":"you-passed-slotduration-but-this-event-type-is-n","errorCode":null,"errorMessage":"You passed 'slotDuration' but this event type is not a variable length event type.","messagePattern":"You passed 'slotDuration' but this event type is not a variable length event type\\.","errorType":"http","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"apps/api/v2/src/modules/slots/slots-2024-09-04/services/slots.service.ts","lineNumber":219,"sourceCode":"\n  private async checkSlotOverlap(eventTypeId: number, startDate: string, endDate: string) {\n    const overlappingReservation = await this.slotsRepository.getOverlappingSlotReservation(\n      eventTypeId,\n      startDate,\n      endDate\n    );\n\n    if (overlappingReservation) {\n      throw new UnprocessableEntityException(\n        `This time slot is already reserved by another user. Please choose a different time.`\n      );\n    }\n  }\n\n  validateSlotDuration(eventType: EventType, inputSlotDuration: number) {\n    const eventTypeMetadata = eventTypeMetadataSchema.parse(eventType.metadata);\n    if (!eventTypeMetadata?.multipleDuration) {\n      throw new BadRequestException(\n        \"You passed 'slotDuration' but this event type is not a variable length event type.\"\n      );\n    }\n\n    if (!eventTypeMetadata.multipleDuration.includes(inputSlotDuration)) {\n      throw new BadRequestException(\n        `Provided 'slotDuration' is not one of the possible lengths for the event type. The possible lengths for this variable length event type are: ${eventTypeMetadata.multipleDuration.join(\n          \", \"\n        )}`\n      );\n    }\n  }\n\n  async canSpecifyCustomReservationDuration(authUserId: number, eventType: EventType) {\n    if (eventType.userId) {\n      return await this.canSpecifyCustomReservationDurationIndividualEvent(authUserId, eventType.userId);\n    }\n    if (eventType.teamId) {","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/calcom/cal.diy/blob/176037d0afbe572f870a3c702985e7cd83fe6c0c/apps/api/v2/src/modules/slots/slots-2024-09-04/services/slots.service.ts#L201-L237","documentation":"A NestJS BadRequestException (HTTP 400) from SlotsService_2024_09_04.validateSlotDuration. The caller passed slotDuration, but eventType.metadata.multipleDuration is absent/falsy. slotDuration is only valid for variable-length event types that declare a multipleDuration array in their metadata. A fixed-length event type rejects an explicit duration.","triggerScenarios":"POST /v2/slots/reserve with a slotDuration field for an event type whose metadata does not include multipleDuration — i.e. a standard fixed-length event type. The DTO allows slotDuration optionally, so this is the runtime semantic check.","commonSituations":"Applying slotDuration uniformly across all event types in a generic booking flow; switching an event type from variable to fixed and leaving stale client code; copying a reserve payload from a variable event to a fixed one.","solutions":["Only send slotDuration for event types whose metadata.multipleDuration is a non-empty array.","Inspect the event type via GET /v2/event-types and branch on whether it is variable-length.","For fixed-length event types, omit slotDuration and let eventType.length apply.","On the client, gate the slotDuration field behind a 'variable length' flag."],"exampleFix":"// before\nfetch('/v2/slots/reserve', { body: JSON.stringify({ eventTypeId, slotStart, slotDuration: 30 }) });\n\n// after — only include slotDuration for variable-length events\nconst body: any = { eventTypeId, slotStart };\nif (eventType.metadata?.multipleDuration?.length) body.slotDuration = 30;\nfetch('/v2/slots/reserve', { body: JSON.stringify(body) });","handlingStrategy":"validation","validationCode":"function buildReserveBody(eventType: { metadata?: { multipleDuration?: number[] } | null }, slotStart: string, slotDuration?: number) {\n  const body: { eventTypeId?: number; slotStart: string; slotDuration?: number } = { slotStart };\n  if (eventType.metadata?.multipleDuration?.length && slotDuration != null) {\n    if (!eventType.metadata.multipleDuration.includes(slotDuration)) {\n      throw new RangeError(`slotDuration must be one of: ${eventType.metadata.multipleDuration.join(', ')}`);\n    }\n    body.slotDuration = slotDuration;\n  }\n  return body;\n}\nconst body = buildReserveBody(eventType, slotStart, input.slotDuration);","typeGuard":"function isVariableLengthEventType(et: { metadata?: { multipleDuration?: number[] } | null }): boolean {\n  return Array.isArray(et.metadata?.multipleDuration) && (et.metadata!.multipleDuration as number[]).length > 0;\n}","tryCatchPattern":"try {\n  await cal.slots.reserve({ eventTypeId, slotStart, slotDuration });\n} catch (e) {\n  if (e instanceof HttpError && e.statusCode === 400 && /variable length/i.test(e.message)) {\n    // event type is fixed-length — retry without slotDuration\n    return cal.slots.reserve({ eventTypeId, slotStart });\n  }\n  throw e;\n}","preventionTips":["Gate slotDuration behind a variable-length check on the event type.","Only pass slotDuration values listed in metadata.multipleDuration.","For fixed-length event types, omit slotDuration.","Inspect event type metadata before building the reserve payload."],"tags":["calcom-api","slots","bad-request","event-type","variable-duration","reservation"],"backgroundTag":null,"analyzedSha":"176037d0afbe572f870a3c702985e7cd83fe6c0c","analyzedAt":"2026-08-12T19:12:41.464Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}