{"record":{"id":"1219d7d8f8f10219","repo":"calcom/cal.diy","slug":"can-t-specify-lengthinminutes-because-event-type","errorCode":null,"errorMessage":"Can't specify 'lengthInMinutes' because event type does not have multiple possible lengths. Please, remove the 'lengthInMinutes' field from the request.","messagePattern":"Can't specify 'lengthInMinutes' because event type does not have multiple possible lengths\\. Please, remove the 'lengthInMinutes' field from the request\\.","errorType":"exception","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"apps/api/v2/src/platform/bookings/2024-08-13/services/input.service.ts","lineNumber":226,"sourceCode":"          crmOwnerRecordType?: string;\n        }\n      | undefined\n  ) {\n    if (!routing) return null;\n\n    return {\n      routedTeamMemberIds: routing.teamMemberIds,\n      teamMemberEmail: routing.teamMemberEmail,\n      skipContactOwner: routing.skipContactOwner,\n      crmAppSlug: routing.crmAppSlug,\n      crmOwnerRecordType: routing.crmOwnerRecordType,\n    };\n  }\n\n  validateBookingLengthInMinutes(inputBooking: CreateBookingInput_2024_08_13, eventType: EventType) {\n    const eventTypeMetadata = EventTypeMetaDataSchema.parse(eventType.metadata);\n    if (inputBooking.lengthInMinutes && !eventTypeMetadata?.multipleDuration) {\n      throw new BadRequestException(\n        \"Can't specify 'lengthInMinutes' because event type does not have multiple possible lengths. Please, remove the 'lengthInMinutes' field from the request.\"\n      );\n    }\n    if (\n      inputBooking.lengthInMinutes &&\n      !eventTypeMetadata?.multipleDuration?.includes(inputBooking.lengthInMinutes)\n    ) {\n      throw new BadRequestException(\n        `Provided 'lengthInMinutes' is not one of the possible lengths for the event type. The possible lengths are: ${eventTypeMetadata?.multipleDuration?.join(\n          \", \"\n        )}`\n      );\n    }\n  }\n\n  async createRecurringBookingRequest(\n    request: Request,\n    body: CreateRecurringBookingInput_2024_08_13,","sourceCodeStart":208,"sourceCodeEnd":244,"githubUrl":"https://github.com/calcom/cal.diy/blob/176037d0afbe572f870a3c702985e7cd83fe6c0c/apps/api/v2/src/platform/bookings/2024-08-13/services/input.service.ts#L208-L244","documentation":"Thrown by InputBookingsService.validateBookingLengthInMinutes when inputBooking.lengthInMinutes is set but the event type's metadata does not define multipleDuration. BadRequestException (HTTP 400). Single-duration event types have one fixed length, so the client is not allowed to override it — the field must be omitted.","triggerScenarios":"POST /v2/bookings (or /recurring) with a lengthInMinutes field against an event type whose metadata.multipleDuration is absent/empty. Single-length event types derive duration solely from eventType.length; the API rejects any client-supplied duration.","commonSituations":"Client code sends lengthInMinutes unconditionally for all event types; event type was changed from multi-duration to single-duration; copy/pasted booking payload from a multi-duration event type; misunderstanding that lengthInMinutes is only valid when the event type advertises multiple durations.","solutions":["Remove the lengthInMinutes field from the request body for single-duration event types.","Conditionally include lengthInMinutes only when the event type's metadata.multipleDuration is a non-empty array.","Fetch the event type first and branch payload construction on whether multipleDuration exists.","If variable length is required, convert the event type to a multi-duration event type in the dashboard."],"exampleFix":"// before\nbody: { eventTypeId, start, lengthInMinutes: 30, attendee: {...} }\n\n// after\nconst et = await api.get(`/v2/event-types/${eventTypeId}`);\nconst body = { eventTypeId, start, attendee: {...} };\nif (et.data.metadata?.multipleDuration?.length) body.lengthInMinutes = 30;","handlingStrategy":"validation","validationCode":"const et = await api.get(`/v2/event-types/${eventTypeId}`);\nconst multi = et.data.metadata?.multipleDuration;\nconst bodyToSend = multi?.length ? { ...body, lengthInMinutes: body.lengthInMinutes } : (() => { const { lengthInMinutes, ...rest } = body; return rest; })();","typeGuard":"const isMultiDuration = (et: { metadata?: { multipleDuration?: number[] } }): boolean =>\n  Array.isArray(et.metadata?.multipleDuration) && (et.metadata?.multipleDuration?.length ?? 0) > 0;","tryCatchPattern":"try { await api.post('/v2/bookings', body); }\ncatch (e) {\n  if (e.response?.status === 400 && /Can't specify 'lengthInMinutes'/.test(e.response.data.message)) {\n    const { lengthInMinutes, ...rest } = body;\n    await api.post('/v2/bookings', rest);\n  } else throw e;\n}","preventionTips":["Only include lengthInMinutes when the event type advertises multipleDuration.","Branch payload construction on the fetched event type's metadata.","Convert the event type to multi-duration if variable length is required."],"tags":["api","bookings","event-types","multi-duration","validation","nestjs"],"backgroundTag":null,"analyzedSha":"176037d0afbe572f870a3c702985e7cd83fe6c0c","analyzedAt":"2026-08-12T19:12:41.464Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}