{"record":{"id":"30595c840df8f8cc","repo":"calcom/cal.diy","slug":"can-t-reassign-the-booking-because-no-other-host-i","errorCode":null,"errorMessage":"Can't reassign the booking because no other host is available at that time.","messagePattern":"Can't reassign the booking because no other host is available at that time\\.","errorType":"exception","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"apps/api/v2/src/platform/bookings/2024-08-13/services/bookings.service.ts","lineNumber":1035,"sourceCode":"\n    const emailsEnabled = platformClientParams ? platformClientParams.arePlatformEmailsEnabled : true;\n\n    const profile = this.usersService.getUserMainProfile(reassignedByUser);\n\n    try {\n      await roundRobinReassignment({\n        bookingId: booking.id,\n        orgId: profile?.organizationId || null,\n        emailsEnabled,\n        platformClientParams,\n        reassignedById: reassignedByUser.id,\n        actionSource: \"API_V2\",\n        reassignedByUuid: reassignedByUser.uuid,\n      });\n    } catch (error) {\n      if (error instanceof Error) {\n        if (error.message === \"no_available_users_found_error\") {\n          throw new BadRequestException(\n            \"Can't reassign the booking because no other host is available at that time.\"\n          );\n        }\n      }\n      throw error;\n    }\n\n    const reassigned = await this.bookingsRepository.getByUidWithUser(bookingUid);\n    if (!reassigned) {\n      throw new NotFoundException(`Reassigned booking with uid=${bookingUid} was not found in the database`);\n    }\n\n    return this.outputService.getOutputReassignedBooking(reassigned);\n  }\n\n  async reassignBookingToUser(\n    bookingUid: string,\n    newUserId: number,","sourceCodeStart":1017,"sourceCodeEnd":1053,"githubUrl":"https://github.com/calcom/cal.diy/blob/176037d0afbe572f870a3c702985e7cd83fe6c0c/apps/api/v2/src/platform/bookings/2024-08-13/services/bookings.service.ts#L1017-L1053","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Add more hosts to the event type to widen the candidate pool.","Retry at a time when other hosts are known to be free, or adjust the event-type availability schedule.","Use the reassign-to-user flow (reassignBookingToUser) to force reassignment to a specific eligible host.","Temporarily relax constraints (e.g., disabled-user filtering) on the event type."],"exampleFix":"// before\nawait apiClient.post(`/v2/bookings/${uid}/reassign`);\n\n// after\ntry {\n  await apiClient.post(`/v2/bookings/${uid}/reassign`);\n} catch (err) {\n  if (err.response?.status === 400 && /no other host is available/i.test(err.response?.data?.message ?? '')) {\n    // fall back to picking an explicit host\n    const hostId = await chooseEligibleHost(bookingUid);\n    await apiClient.post(`/v2/bookings/${uid}/reassign-to-user`, { userId: hostId });\n  } else throw err;\n}","handlingStrategy":"try-catch","validationCode":"// Best-effort: estimate whether other hosts are free before reassign\nconst hosts = await getEligibleRoundRobinHosts(bookingUid);\nif (hosts.length <= 1) {\n  throw new Error('No alternative hosts available; widen the host pool or use reassign-to-user');\n}","typeGuard":"function isNoHostAvailable(err: unknown): boolean {\n  return typeof err === 'object' && err !== null &&\n    (err as any).response?.status === 400 &&\n    /no other host is available/i.test((err as any).response?.data?.message ?? '');\n}","tryCatchPattern":"try {\n  await apiClient.post(`/v2/bookings/${uid}/reassign`);\n} catch (err) {\n  if (isNoHostAvailable(err)) {\n    const hostId = await chooseEligibleHost(uid);\n    await apiClient.post(`/v2/bookings/${uid}/reassign-to-user`, { userId: hostId });\n    return;\n  }\n  throw err;\n}","preventionTips":["Keep at least 3+ hosts on round-robin event types.","Maintain accurate availability schedules and connected calendars for all hosts.","Fall back to manual reassign-to-user when auto-reassign reports no hosts."],"tags":["round-robin","availability","booking","api-v2","reassign"],"backgroundTag":null,"analyzedSha":"176037d0afbe572f870a3c702985e7cd83fe6c0c","analyzedAt":"2026-08-12T19:12:41.464Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}