{"record":{"id":"f75ea9b619e0df59","repo":"calcom/cal.diy","slug":"payment-with-uid-uid-not-found","errorCode":null,"errorMessage":"Payment with uid ${uid} not found","messagePattern":"Payment with uid (.+?) not found","errorType":"exception","errorClass":"NotFoundException","httpStatus":404,"severity":"error","filePath":"apps/api/v2/src/modules/atoms/services/event-types-atom.service.ts","lineNumber":315,"sourceCode":"              ...(teams.length && {\n                credentialOwner,\n              }),\n              userCredentialIds,\n              invalidCredentialIds,\n              teams,\n              isInstalled: !!userCredentialIds.length || !!teams.length || app.isGlobal,\n              isSetupAlready,\n              ...(app.dependencies && { dependencyData }),\n            };\n          }\n        )\n    );\n    return apps[0];\n  }\n\n  async getUserPaymentInfo(uid: string) {\n    const rawPayment = await this.atomsRepository.getRawPayment(uid);\n    if (!rawPayment) throw new NotFoundException(`Payment with uid ${uid} not found`);\n    const { data, booking: _booking, ...restPayment } = rawPayment;\n    const payment = {\n      ...restPayment,\n      data: data as Record<string, unknown>,\n    };\n    if (!_booking) throw new NotFoundException(`Booking with uid ${uid} not found`);\n    const { startTime, endTime, eventType, ...restBooking } = _booking;\n    const booking = {\n      ...restBooking,\n      startTime: startTime.toString(),\n      endTime: endTime.toString(),\n    };\n    if (!eventType) throw new NotFoundException(`Event type with uid ${uid} not found`);\n    if (eventType.users.length === 0 && !eventType.team)\n      throw new NotFoundException(`No users found or no team present for event type with uid ${uid}`);\n    const [user] = eventType?.users.length\n      ? eventType.users\n      : [{ name: null, theme: null, hideBranding: null, username: null }];","sourceCodeStart":297,"sourceCodeEnd":333,"githubUrl":"https://github.com/calcom/cal.diy/blob/176037d0afbe572f870a3c702985e7cd83fe6c0c/apps/api/v2/src/modules/atoms/services/event-types-atom.service.ts#L297-L333","documentation":"Thrown by EventTypesAtomService.getUserPaymentInfo when atomsRepository.getRawPayment returns null for the given uid. The rawPayment query joins the payment table on uid; if no payment record exists with that uid, the entire payment-info response cannot be constructed and NotFoundException (HTTP 404) is thrown. This is the first guard in a chain of four null checks (payment, booking, eventType, users/team).","triggerScenarios":"Calling the payment-info endpoint with a uid that doesn't exist in the payment table. The uid was from a payment app (e.g. Stripe) test mode that isn't synced to the production database. The payment was refunded and soft-deleted, removing it from the query results.","commonSituations":"Frontend using a payment uid from a test webhook that wasn't fully processed. Database inconsistency where the payment record was deleted but the booking still references it. Typo or truncation in the uid (uids are typically long alphanumeric strings). Using a booking uid instead of a payment uid.","solutions":["Verify the uid is a valid payment uid (not a booking uid) and exists in the payment table.","If using Stripe, confirm the payment was created in the same environment (test vs live mode).","Check if the payment was soft-deleted or refunded, which may exclude it from the query.","Trace the uid from the source (webhook payload, checkout session, or booking response) to ensure it's a payment uid."],"exampleFix":"// before: passing booking uid instead of payment uid\nconst paymentInfo = await api.get(`/v2/atoms/payment-info/${bookingUid}`);\n\n// after: use the correct payment uid from the payment flow\nconst payment = await api.get(`/v2/payments?bookingUid=${bookingUid}`);\nif (!payment?.uid) {\n  throw new Error('No payment record found for this booking.');\n}\nconst paymentInfo = await api.get(`/v2/atoms/payment-info/${payment.uid}`);","handlingStrategy":"validation","validationCode":"// Verify the payment uid exists before fetching payment info\nconst verifyPaymentUid = async (api: ApiClient, uid: string): Promise<void> => {\n  const payment = await api.get(`/v2/payments/${uid}`).catch(() => null);\n  if (!payment) {\n    throw new Error(`No payment record found for uid '${uid}'. Verify it is a payment uid, not a booking uid.`);\n  }\n};","typeGuard":null,"tryCatchPattern":"// Handle payment-not-found gracefully\ntry {\n  return await api.get(`/v2/atoms/payment-info/${uid}`);\n} catch (err: any) {\n  if (err?.response?.status === 404) {\n    return { found: false, message: `Payment ${uid} not found.` };\n  }\n  throw err;\n}","preventionTips":["Distinguish between payment uids and booking uids in your client code — they are different identifiers.","Store the payment uid from the payment creation or webhook response rather than constructing it from other data.","When using Stripe, ensure you're querying the same mode (test vs live) where the payment was created."],"tags":["not-found","payment","atoms","nestjs","api-v2"],"backgroundTag":null,"analyzedSha":"176037d0afbe572f870a3c702985e7cd83fe6c0c","analyzedAt":"2026-08-12T19:12:41.464Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}