{"record":{"id":"7fa1657a627a961a","repo":"calcom/cal.diy","slug":"slot-with-uid-uid-not-found","errorCode":null,"errorMessage":"Slot with uid=${uid} not found","messagePattern":"Slot with uid=(.+?) not found","errorType":"http","errorClass":"NotFoundException","httpStatus":404,"severity":"error","filePath":"apps/api/v2/src/modules/slots/slots-2024-09-04/services/slots.service.ts","lineNumber":274,"sourceCode":"      return false;\n    }\n    const orgMembership = await this.membershipsRepository.findMembershipByTeamId(team.parentId, authUserId);\n    const hasAcceptedOrgMembership = !!orgMembership?.accepted;\n    return hasAcceptedOrgMembership;\n  }\n\n  async getReservedSlot(uid: string) {\n    const slot = await this.slotsRepository.getByUid(uid);\n    if (!slot) {\n      return null;\n    }\n    return this.slotsOutputService.getReservationSlot(slot);\n  }\n\n  async updateReservedSlot(input: ReserveSlotInput_2024_09_04, uid: string) {\n    const dbSlot = await this.slotsRepository.getByUid(uid);\n    if (!dbSlot) {\n      throw new NotFoundException(`Slot with uid=${uid} not found`);\n    }\n\n    const eventType = await this.eventTypeRepository.getEventTypeWithHosts(input.eventTypeId);\n    if (!eventType) {\n      throw new NotFoundException(`Event Type with ID=${input.eventTypeId} not found`);\n    }\n\n    const startDate = DateTime.fromISO(input.slotStart, { zone: \"utc\" });\n    if (!startDate.isValid) {\n      throw new BadRequestException(\"Invalid start date\");\n    }\n\n    if (input.slotDuration) {\n      this.validateSlotDuration(eventType, input.slotDuration);\n    }\n\n    const endDate = startDate.plus({ minutes: input.slotDuration ?? eventType.length });\n    if (!endDate.isValid) {","sourceCodeStart":256,"sourceCodeEnd":292,"githubUrl":"https://github.com/calcom/cal.diy/blob/176037d0afbe572f870a3c702985e7cd83fe6c0c/apps/api/v2/src/modules/slots/slots-2024-09-04/services/slots.service.ts#L256-L292","documentation":"Thrown by SlotsService.updateReservedSlot when PATCHing a reservation slot whose uid does not exist in the slots table. The service calls slotsRepository.getByUid(uid) and, on a null result, throws 404 NotFound. Slot reservations are temporary rows with a reservationDuration TTL, so a uid can disappear between reserve and update.","triggerScenarios":"PATCH /v2/slots/{uid} (or the slots-2024-09-04 update endpoint) with a uid that was never created, has already expired past its reservationDuration (default DEFAULT_RESERVATION_DURATION), was converted into a booking, or belongs to a different environment.","commonSituations":"The reservation expired before the user confirmed (short reservationDuration). The uid was copied from a staging environment into production. The slot was already turned into a booking and the reservation row removed. A typo or truncation in the uid.","solutions":["Reserve a fresh slot with POST /v2/event-types/{eventTypeId}/slots and use the returned uid for the update.","GET the slot by uid before PATCHing; if it 404s, re-reserve.","Increase reservationDuration when creating the slot to give the user more time to confirm."],"exampleFix":"// before\nawait api.patchSlot(staleUid, body);\n\n// after\nconst fresh = await api.reserveSlot({ eventTypeId, slotStart, reservationDuration: 15 });\nawait api.patchSlot(fresh.uid, { ...body, eventTypeId, slotStart });","handlingStrategy":"validation","validationCode":"async function getEditableSlot(api, uid: string) {\n  const slot = await api.getReservedSlot(uid).catch(() => null);\n  if (!slot) return null; // caller should re-reserve\n  return slot;\n}\n\n// usage before PATCH:\n// const slot = await getEditableSlot(api, uid);\n// if (!slot) { const fresh = await api.reserveSlot(...); uid = fresh.uid; }","typeGuard":"function isLiveReservation(\n  slot: { uid: string; expiresAt?: string } | null\n): slot is { uid: string } {\n  return !!slot && (!slot.expiresAt || new Date(slot.expiresAt) > new Date());\n}","tryCatchPattern":"try {\n  return await api.updateReservedSlot(uid, body);\n} catch (e) {\n  if (e.status === 404 && /Slot with uid=/.test(e.message)) {\n    const fresh = await api.reserveSlot({ eventTypeId, slotStart });\n    return api.updateReservedSlot(fresh.uid, { ...body, slotStart });\n  }\n  throw e;\n}","preventionTips":["Reserve slots with a reservationDuration long enough to cover user confirmation latency.","Trigger the PATCH immediately after the user confirms while the reservation is fresh.","Treat slot uids as ephemeral; never persist them as long-lived references."],"tags":["slots","not-found","reservation","api-v2","ttl"],"backgroundTag":null,"analyzedSha":"176037d0afbe572f870a3c702985e7cd83fe6c0c","analyzedAt":"2026-08-12T19:12:41.464Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}