calcom/cal.diy · error · BadRequestException

Can't reassign the booking because no other host is availabl

Error message

Can't reassign the booking because no other host is available at that time.

What it means

Thrown when roundRobinReassignment rejects with the literal error message "no_available_users_found_error"; the service translates that into a NestJS BadRequestException (HTTP 400). It means the round-robin reassignment engine could not find any other eligible host who is free at the booking's time slot. All other unexpected errors are re-thrown unchanged.

Source

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

    const emailsEnabled = platformClientParams ? platformClientParams.arePlatformEmailsEnabled : true;

    const profile = this.usersService.getUserMainProfile(reassignedByUser);

    try {
      await roundRobinReassignment({
        bookingId: booking.id,
        orgId: profile?.organizationId || null,
        emailsEnabled,
        platformClientParams,
        reassignedById: reassignedByUser.id,
        actionSource: "API_V2",
        reassignedByUuid: reassignedByUser.uuid,
      });
    } catch (error) {
      if (error instanceof Error) {
        if (error.message === "no_available_users_found_error") {
          throw new BadRequestException(
            "Can't reassign the booking because no other host is available at that time."
          );
        }
      }
      throw error;
    }

    const reassigned = await this.bookingsRepository.getByUidWithUser(bookingUid);
    if (!reassigned) {
      throw new NotFoundException(`Reassigned booking with uid=${bookingUid} was not found in the database`);
    }

    return this.outputService.getOutputReassignedBooking(reassigned);
  }

  async reassignBookingToUser(
    bookingUid: string,
    newUserId: number,

View on GitHub (pinned to 176037d0af)

Solutions

  1. Add more hosts to the event type to widen the candidate pool.
  2. Retry at a time when other hosts are known to be free, or adjust the event-type availability schedule.
  3. Use the reassign-to-user flow (reassignBookingToUser) to force reassignment to a specific eligible host.
  4. Temporarily relax constraints (e.g., disabled-user filtering) on the event type.

Example fix

// before
await apiClient.post(`/v2/bookings/${uid}/reassign`);

// after
try {
  await apiClient.post(`/v2/bookings/${uid}/reassign`);
} catch (err) {
  if (err.response?.status === 400 && /no other host is available/i.test(err.response?.data?.message ?? '')) {
    // fall back to picking an explicit host
    const hostId = await chooseEligibleHost(bookingUid);
    await apiClient.post(`/v2/bookings/${uid}/reassign-to-user`, { userId: hostId });
  } else throw err;
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Best-effort: estimate whether other hosts are free before reassign
const hosts = await getEligibleRoundRobinHosts(bookingUid);
if (hosts.length <= 1) {
  throw new Error('No alternative hosts available; widen the host pool or use reassign-to-user');
}

Type guard

function isNoHostAvailable(err: unknown): boolean {
  return typeof err === 'object' && err !== null &&
    (err as any).response?.status === 400 &&
    /no other host is available/i.test((err as any).response?.data?.message ?? '');
}

Try / catch

try {
  await apiClient.post(`/v2/bookings/${uid}/reassign`);
} catch (err) {
  if (isNoHostAvailable(err)) {
    const hostId = await chooseEligibleHost(uid);
    await apiClient.post(`/v2/bookings/${uid}/reassign-to-user`, { userId: hostId });
    return;
  }
  throw err;
}

Prevention

When it happens

Trigger: POST reassign on a round-robin booking where every other potential host has a conflicting calendar event, is marked unavailable, or excluded by event-type constraints (e.g., hideDisabledUsers, metadata filters).

Common situations: Round-robin event types with a very small host pool (1-2 users) where the only alternative is busy; restrictive availability schedules; hosts' connected calendars all show conflicts at that instant; after-hours or timezone gaps shrinking the candidate set.

Related errors


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