calcom/cal.diy · error · BadRequestException

Missing or invalid location value for type: ${inputLocation.

Error message

Missing or invalid location value for type: ${inputLocation.type}

What it means

Thrown in updateLocation for the non-integration branch when getNonIntegrationLocationValue returns undefined. That helper returns the value field for each known type (address, link, phone, attendeeAddress, attendeePhone, attendeeDefined); it returns undefined when the type is unrecognized OR when the corresponding value field is empty/undefined.

Source

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

    const existingBookingHost = await this.usersRepository.findById(existingBooking.userId);

    if (!existingBookingHost) {
      throw new NotFoundException(`No user found for booking with uid=${bookingUid}`);
    }

    if (inputLocation.type === "integration") {
      return this.integrationService.handleIntegrationLocationUpdate(
        existingBooking,
        inputLocation,
        user,
        existingBookingHost
      );
    }

    const bookingLocation = this.getNonIntegrationLocationValue(inputLocation);
    if (!bookingLocation) {
      throw new BadRequestException(`Missing or invalid location value for type: ${inputLocation.type}`);
    }

    const bookingFieldsLocation = this.inputService.transformLocation(inputLocation);

    const responses = (existingBooking.responses || {}) as Record<string, unknown>;
    const { location: _existingLocation, ...rest } = responses;

    const updatedBookingResponses = {
      ...rest,
      location: bookingFieldsLocation,
    };

    const metadataWithoutVideoUrl = this.getMetadataWithoutVideoCallUrl(existingBooking.metadata);

    await this.bookingVideoService.deleteOldVideoMeetingIfNeeded(existingBooking.id);

    const updatedBooking = await this.bookingsRepository.updateBooking(bookingUid, {
      location: bookingLocation,

View on GitHub (pinned to 176037d0af)

Solutions

  1. Provide the required value field for the chosen location type (phone for "phone"/"attendeePhone", link for "link", address for "address"/"attendeeAddress", location for "attendeeDefined").
  2. Use one of the supported location types (address, link, phone, attendeeAddress, attendeePhone, attendeeDefined, integration).
  3. Validate the payload on the client before sending.

Example fix

// before
{ location: { type: 'phone' } }            // missing phone -> BadRequestException
// after
{ location: { type: 'phone', phone: '+15551234567' } }
Defensive patterns

Strategy: type-guard

Validate before calling

// Build and validate the location payload before sending.
function buildLocation(loc) {
  if (loc.type === 'phone' && !loc.phone) throw new Error('phone location requires a phone value');
  if (loc.type === 'link' && !loc.link) throw new Error('link location requires a link value');
  if (loc.type === 'address' && !loc.address) throw new Error('address location requires an address value');
  if (loc.type === 'attendeeDefined' && !loc.location) throw new Error('attendeeDefined requires a location value');
  return loc;
}

Type guard

function isValidLocationPayload(loc: { type: string; [k: string]: unknown }): boolean {
  switch (loc.type) {
    case 'address': return typeof loc.address === 'string' && loc.address.length > 0;
    case 'link': return typeof loc.link === 'string' && loc.link.length > 0;
    case 'phone': return typeof loc.phone === 'string' && loc.phone.length > 0;
    case 'attendeeAddress': return typeof loc.address === 'string' && loc.address.length > 0;
    case 'attendeePhone': return typeof loc.phone === 'string' && loc.phone.length > 0;
    case 'attendeeDefined': return typeof loc.location === 'string' && loc.location.length > 0;
    case 'integration': return true;
    default: return false;
  }
}

Try / catch

try {
  await api.patch(`/v2/bookings/${uid}/location`, { location: buildLocation(payload) });
} catch (err) {
  if (err.status === 400 && /Missing or invalid location value/.test(err.message)) {
    // fix the payload: add the missing value field for the chosen type
  }
  throw err;
}

Prevention

When it happens

Trigger: PATCH booking location with location.type other than "integration", but the matching payload field is missing or empty — e.g. { type: "phone" } with no phone, { type: "link" } with empty link, { type: "address" } with no address.

Common situations: Client omits the value field for the chosen location type; sends a blank string; uses a location type not in the supported set; frontend bug building the payload.

Related errors


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