{"record":{"id":"d3ead8263b8ccb45","repo":"calcom/cal.diy","slug":"invalid-option-submittedvalue-for-booking-fie","errorCode":null,"errorMessage":"Invalid option '${submittedValue}' for booking field '${eventTypeBookingField.name}'. Allowed options are: ${allowedOptionValues.join(\", \")}.","messagePattern":"Invalid option '(.+?)' for booking field '(.+?)'\\. Allowed options are: (.+?)\\.","errorType":"exception","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"apps/api/v2/src/platform/bookings/2024-08-13/services/bookings.service.ts","lineNumber":300,"sourceCode":"            isValidType = bookingFieldResponseValueType === \"string\";\n            break;\n          case \"multiemail\":\n            expectedBookingFieldResponseValueType = \"array\";\n            isValidType = Array.isArray(bookingFieldResponseValue);\n            break;\n          case \"boolean\":\n            expectedBookingFieldResponseValueType = \"boolean\";\n            isValidType = bookingFieldResponseValueType === \"boolean\";\n            break;\n          case \"select\":\n            expectedBookingFieldResponseValueType = \"string or number\";\n            isValidType =\n              bookingFieldResponseValueType === \"string\" || bookingFieldResponseValueType === \"number\";\n            if (isValidType && Array.isArray(eventTypeBookingField.options)) {\n              const submittedValue = bookingFieldResponseValue as string | number;\n              const allowedOptionValues = eventTypeBookingField.options.map((opt) => opt.value);\n              if (!this.isValidSingleOptionValue(submittedValue, allowedOptionValues)) {\n                throw new BadRequestException(\n                  `Invalid option '${submittedValue}' for booking field '${\n                    eventTypeBookingField.name\n                  }'. Allowed options are: ${allowedOptionValues.join(\", \")}.`\n                );\n              }\n            }\n            break;\n          case \"multiselect\":\n            expectedBookingFieldResponseValueType = \"array\";\n            isValidType = Array.isArray(bookingFieldResponseValue);\n            if (isValidType && Array.isArray(eventTypeBookingField.options)) {\n              const submittedValues = bookingFieldResponseValue as (string | number)[];\n              const allowedOptionValues = eventTypeBookingField.options.map((opt) => opt.value);\n              if (!this.areValidMultipleOptionValues(submittedValues, allowedOptionValues)) {\n                throw new BadRequestException(\n                  `One or more invalid options for booking field '${\n                    eventTypeBookingField.name\n                  }'. Allowed options are: ${allowedOptionValues.join(\", \")}.`","sourceCodeStart":282,"sourceCodeEnd":318,"githubUrl":"https://github.com/calcom/cal.diy/blob/176037d0afbe572f870a3c702985e7cd83fe6c0c/apps/api/v2/src/platform/bookings/2024-08-13/services/bookings.service.ts#L282-L318","documentation":"Thrown during booking field validation for a 'select' type booking field. After confirming the submitted value is a string or number and that the field defines options, the service calls isValidSingleOptionValue; if the submitted value is not among the allowed option values, a BadRequestException (HTTP 400) is raised naming the field and listing valid options.","triggerScenarios":"A booking request submits a value for a select-type custom question/field that does not match any of the configured option values (exact match required, including type).","commonSituations":"Option values changed on the event type after integration built; case mismatch; sending the option label instead of its value; numeric vs string type mismatch.","solutions":["Fetch the event type and read the select field's options array to get exact allowed values.","Submit a value that exactly matches one of opt.value entries (case and type sensitive).","If a new option is needed, add it to the event type field configuration first."],"exampleFix":"// before — field 'department' options are ['sales','support']\nconst responses = { department: 'Sales' }; // wrong case\n// after\nconst responses = { department: 'sales' };","handlingStrategy":"validation","validationCode":"const field = et.bookingFields.find(f => f.name === 'department');\nconst allowed = field.options.map(o => o.value);\nif (!allowed.includes(body.responses.department)) throw new Error(`Invalid; use one of ${allowed}`);","typeGuard":"function isValidSingleOption(v: string | number, allowed: (string | number)[]): boolean {\n  return allowed.includes(v);\n}","tryCatchPattern":"try { await client.post('/v2/bookings', body); }\ncatch (e) {\n  if (e.status === 400 && /Invalid option/.test(e.message)) { /* refresh options, correct value */ }\n  else throw e;\n}","preventionTips":["Render select dropdowns from the field options array","Compare against value not label","Re-fetch event type when options may have changed"],"tags":["api-v2","bookings","validation","select","options"],"backgroundTag":null,"analyzedSha":"176037d0afbe572f870a3c702985e7cd83fe6c0c","analyzedAt":"2026-08-12T19:12:41.464Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}