calcom/cal.diy · error · BadRequestException

Booking location with type ${inputBookingLocation.type} not

Error message

Booking location with type ${inputBookingLocation.type} not valid for event type with id=${dbEventType.id}. The event type has following location types: ${allowedLocationTypes.join(", ")}, and only these types are allowed for booking location.

What it means

Thrown by isBookingLocationWithEventTypeLocations when the booking location's type is not among the event type's configured location types. BadRequestException (HTTP 400). The event type's locations are transformed to their API types and the booking location type must appear in that list; otherwise the booking would select a location the organizer did not enable.

Source

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

      `Booking location with type ${(location as BookingInputLocation_2024_08_13).type} not valid.`
    );
  }

  private isBookingLocationWithEventTypeLocations(
    inputBookingLocation: undefined | string | BookingInputLocation_2024_08_13,
    dbEventType: EventType
  ) {
    if (!inputBookingLocation || typeof inputBookingLocation === "string") {
      // note(Lauris): for backwards compatibility because we had string locations before so let them pass.
      return true;
    }

    const eventTypeLocations = this.outputEventTypesService.transformLocations(dbEventType.locations);
    const allowedLocationTypes = eventTypeLocations.map((location) => location.type);

    const isAllowed = allowedLocationTypes.includes(inputBookingLocation.type);
    if (!isAllowed) {
      throw new BadRequestException(
        `Booking location with type ${inputBookingLocation.type} not valid for event type with id=${
          dbEventType.id
        }. The event type has following location types: ${allowedLocationTypes.join(
          ", "
        )}, and only these types are allowed for booking location.`
      );
    }

    if (inputBookingLocation.type === "integration" && "integration" in inputBookingLocation) {
      const allowedIntegrations = eventTypeLocations
        .filter((location) => location.type === "integration")
        .map((location) => location.integration);

      const isAllowedIntegration = allowedIntegrations.includes(inputBookingLocation.integration);
      if (!isAllowedIntegration) {
        throw new BadRequestException(
          `Booking location with integration ${
            inputBookingLocation.integration

View on GitHub (pinned to 176037d0af)

Solutions

  1. Fetch GET /v2/event-types/{id} and read its locations to learn which type values are allowed.
  2. Send a location object whose type is in that list (or send a string location for backwards compatibility).
  3. Update the event type in the dashboard to enable the desired location type if the booker needs it.
  4. Validate the location type client-side against the fetched event type before POSTing.

Example fix

// before
location: { type: 'attendeePhone', phone: '+1...' }  // event type only allows ['address','integration']

// after
const et = await api.get(`/v2/event-types/${eventTypeId}`);
const allowed = et.data.locations.map(l => l.type);
location = allowed.includes('attendeePhone') ? { type:'attendeePhone', phone:'+1...' } : { type: allowed[0] };
Defensive patterns

Strategy: validation

Validate before calling

const et = await api.get(`/v2/event-types/${eventTypeId}`);
const allowedTypes = et.data.locations.map(l => l.type);
if (typeof body.location === 'object' && !allowedTypes.includes(body.location.type)) {
  throw new Error(`location type not allowed; pick one of ${allowedTypes.join(', ')}`);
}

Type guard

const isAllowedLocationType = (type: string, allowed: string[]): boolean => allowed.includes(type);

Try / catch

try { await api.post('/v2/bookings', body); }
catch (e) {
  if (e.response?.status === 400 && /not valid for event type with id/.test(e.response.data.message)) {
    /* switch body.location.type to one listed in the error and retry */
  } else throw e;
}

Prevention

When it happens

Trigger: POST /v2/bookings with a location object whose type (e.g. 'attendeePhone') is not in the event type's allowed location types (e.g. the event type only allows 'address' and 'integration'). The validator computes allowedLocationTypes from the event type and rejects mismatches. String locations are allowed for backwards compatibility and skip this check.

Common situations: Client offers a location type the organizer never enabled on the event type; event type's locations were edited after the client cached them; mismatched expectations between embed config and event type; sending an integration location when only in-person is configured.

Related errors


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