calcom/cal.diy · error · BadRequestException

Invalid option '${submittedValue}' for booking field '${even

Error message

Invalid option '${submittedValue}' for booking field '${eventTypeBookingField.name}'. Allowed options are: ${allowedOptionValues.join(", ")}.

What it means

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.

Source

Thrown at apps/api/v2/src/platform/bookings/2024-08-13/services/bookings.service.ts:300

            isValidType = bookingFieldResponseValueType === "string";
            break;
          case "multiemail":
            expectedBookingFieldResponseValueType = "array";
            isValidType = Array.isArray(bookingFieldResponseValue);
            break;
          case "boolean":
            expectedBookingFieldResponseValueType = "boolean";
            isValidType = bookingFieldResponseValueType === "boolean";
            break;
          case "select":
            expectedBookingFieldResponseValueType = "string or number";
            isValidType =
              bookingFieldResponseValueType === "string" || bookingFieldResponseValueType === "number";
            if (isValidType && Array.isArray(eventTypeBookingField.options)) {
              const submittedValue = bookingFieldResponseValue as string | number;
              const allowedOptionValues = eventTypeBookingField.options.map((opt) => opt.value);
              if (!this.isValidSingleOptionValue(submittedValue, allowedOptionValues)) {
                throw new BadRequestException(
                  `Invalid option '${submittedValue}' for booking field '${
                    eventTypeBookingField.name
                  }'. Allowed options are: ${allowedOptionValues.join(", ")}.`
                );
              }
            }
            break;
          case "multiselect":
            expectedBookingFieldResponseValueType = "array";
            isValidType = Array.isArray(bookingFieldResponseValue);
            if (isValidType && Array.isArray(eventTypeBookingField.options)) {
              const submittedValues = bookingFieldResponseValue as (string | number)[];
              const allowedOptionValues = eventTypeBookingField.options.map((opt) => opt.value);
              if (!this.areValidMultipleOptionValues(submittedValues, allowedOptionValues)) {
                throw new BadRequestException(
                  `One or more invalid options for booking field '${
                    eventTypeBookingField.name
                  }'. Allowed options are: ${allowedOptionValues.join(", ")}.`

View on GitHub (pinned to 176037d0af)

Solutions

  1. Fetch the event type and read the select field's options array to get exact allowed values.
  2. Submit a value that exactly matches one of opt.value entries (case and type sensitive).
  3. If a new option is needed, add it to the event type field configuration first.

Example fix

// before — field 'department' options are ['sales','support']
const responses = { department: 'Sales' }; // wrong case
// after
const responses = { department: 'sales' };
Defensive patterns

Strategy: validation

Validate before calling

const field = et.bookingFields.find(f => f.name === 'department');
const allowed = field.options.map(o => o.value);
if (!allowed.includes(body.responses.department)) throw new Error(`Invalid; use one of ${allowed}`);

Type guard

function isValidSingleOption(v: string | number, allowed: (string | number)[]): boolean {
  return allowed.includes(v);
}

Try / catch

try { await client.post('/v2/bookings', body); }
catch (e) {
  if (e.status === 400 && /Invalid option/.test(e.message)) { /* refresh options, correct value */ }
  else throw e;
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of calcom/cal.diy@176037d0af (2026-08-12). Data as JSON: /api/errors/d3ead8263b8ccb45. Report an issue: GitHub.