{"record":{"id":"47ed8107252d8d7a","repo":"calcom/cal.diy","slug":"provided-lengthinminutes-is-not-one-of-the-possi","errorCode":null,"errorMessage":"Provided 'lengthInMinutes' is not one of the possible lengths for the event type. The possible lengths are: ${eventTypeMetadata?.multipleDuration?.join(\", \")}","messagePattern":"Provided 'lengthInMinutes' is not one of the possible lengths for the event type\\. The possible lengths are: (.+?)","errorType":"exception","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"apps/api/v2/src/platform/bookings/2024-08-13/services/input.service.ts","lineNumber":234,"sourceCode":"      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,\n    eventType: EventTypeWithOwnerAndTeam\n  ): Promise<BookingRequest> {\n    const oAuthClientParams = await this.platformBookingsService.getOAuthClientParamsForEventType(eventType);\n    // note(Lauris): update to this.transformInputCreate when rescheduling is implemented\n    const bodyTransformed = await this.transformInputCreateRecurringBooking(\n      body,\n      eventType,\n      oAuthClientParams?.platformClientId","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/calcom/cal.diy/blob/176037d0afbe572f870a3c702985e7cd83fe6c0c/apps/api/v2/src/platform/bookings/2024-08-13/services/input.service.ts#L216-L252","documentation":"Thrown by validateBookingLengthInMinutes when lengthInMinutes is provided, the event type DOES have multipleDuration, but the supplied value is not in that list. BadRequestException (HTTP 400). The message enumerates the allowed values (joined by ', ') so the client can correct the value.","triggerScenarios":"POST /v2/bookings against a multi-duration event type with a lengthInMinutes that is not one of metadata.multipleDuration (e.g. sending 45 when allowed durations are [15, 30, 60]). The validator checks Array.includes and rejects.","commonSituations":"Hard-coded duration in the client that does not match the event type's configured set; event type's multipleDuration list was edited; mismatched units (minutes vs hours); stale cached event-type metadata.","solutions":["Read the allowed durations from GET /v2/event-types/{id} -> metadata.multipleDuration and pick one of those exact values.","Refresh cached event-type metadata before constructing the booking payload.","If none of the listed durations fit, update the event type's multipleDuration list to include the desired value.","Validate lengthInMinutes against the fetched list client-side before POSTing."],"exampleFix":"// before\nbody: { eventTypeId, lengthInMinutes: 45, ... }  // allowed: [15,30,60]\n\n// after\nconst et = await api.get(`/v2/event-types/${eventTypeId}`);\nconst allowed = et.data.metadata.multipleDuration;\nbody.lengthInMinutes = allowed.includes(45) ? 45 : allowed[0];","handlingStrategy":"validation","validationCode":"const et = await api.get(`/v2/event-types/${eventTypeId}`);\nconst allowed = et.data.metadata?.multipleDuration ?? [];\nif (body.lengthInMinutes && !allowed.includes(body.lengthInMinutes)) {\n  body.lengthInMinutes = allowed[0];\n}","typeGuard":"const isValidDuration = (length: number, et: { metadata?: { multipleDuration?: number[] } }): boolean =>\n  Array.isArray(et.metadata?.multipleDuration) && (et.metadata?.multipleDuration?.includes(length) ?? false);","tryCatchPattern":"try { await api.post('/v2/bookings', body); }\ncatch (e) {\n  if (e.response?.status === 400 && /not one of the possible lengths/.test(e.response.data.message)) {\n    const m = e.response.data.message.match(/are: (.*)$/);\n    body.lengthInMinutes = Number(m[1].split(',')[0]);\n    await api.post('/v2/bookings', body);\n  } else throw e;\n}","preventionTips":["Read metadata.multipleDuration from the fetched event type and pick an exact value.","Refresh cached event-type metadata before constructing the payload.","Add the desired duration to the event type if none of the listed values fit."],"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"}