{"record":{"id":"d75e7ee54f7a7782","repo":"calcom/cal.diy","slug":"failed-to-get-private-links","errorCode":null,"errorMessage":"Failed to get private links","messagePattern":"Failed to get private links","errorType":"http","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"apps/api/v2/src/platform/event-types-private-links/services/private-links.service.ts","lineNumber":67,"sourceCode":"\n  async getPrivateLinks(eventTypeId: number): Promise<PrivateLinkOutput[]> {\n    try {\n      const links = await this.repo.listByEventTypeId(eventTypeId);\n      const mapped: PrivateLinkData[] = links.map((l) => ({\n        id: l.link,\n        eventTypeId,\n        isExpired: isLinkExpired(l as any),\n        bookingUrl: `${process.env.NEXT_PUBLIC_WEBAPP_URL || \"https://cal.com\"}/d/${l.link}`,\n        expiresAt: l.expiresAt ?? null,\n        maxUsageCount: l.maxUsageCount ?? null,\n        usageCount: l.usageCount ?? 0,\n      }));\n      return this.outputService.transformArrayToOutput(mapped);\n    } catch (error) {\n      if (error instanceof Error) {\n        throw new BadRequestException(error.message);\n      }\n      throw new BadRequestException(\"Failed to get private links\");\n    }\n  }\n\n  async updatePrivateLink(eventTypeId: number, input: UpdatePrivateLinkInput): Promise<PrivateLinkOutput> {\n    try {\n      const transformedInput = this.inputService.transformUpdateInput(input);\n      const updatedResult = await this.repo.update(eventTypeId, {\n        link: transformedInput.linkId,\n        expiresAt: transformedInput.expiresAt ?? null,\n        maxUsageCount: transformedInput.maxUsageCount ?? null,\n      });\n      if (!updatedResult || (updatedResult as any).count === 0) {\n        throw new NotFoundException(\"Updated link not found\");\n      }\n      const updated = await this.repo.findWithEventTypeDetails(transformedInput.linkId);\n      if (!updated) throw new NotFoundException(\"Updated link not found\");\n      const mapped: PrivateLinkData = {\n        id: updated.link,","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/calcom/cal.diy/blob/176037d0afbe572f870a3c702985e7cd83fe6c0c/apps/api/v2/src/platform/event-types-private-links/services/private-links.service.ts#L49-L85","documentation":"The non-Error fallback in PrivateLinksService.getPrivateLinks' catch: if repo.listByEventTypeId or the transform rejects with a value that is not an Error instance, BadRequestException('Failed to get private links') is thrown as a generic message. As with error 395, the original cause is dropped from the response.","triggerScenarios":"A Prisma rejection that isn't an Error instance on this code path; a non-Error thrown inside transformArrayToOutput; a DB connection drop; the output service throwing a plain object.","commonSituations":"DB outage during list; non-Error rejection from a dependency; legacy data that breaks the mapper in a way that throws a non-Error.","solutions":["Check the server logs for the original rejected value.","Confirm the eventTypeId is valid and the table is reachable.","If reproducible, log the caught value temporarily to identify the inner cause."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await privateLinksService.getPrivateLinks(eventTypeId);\n} catch (e) {\n  if (e instanceof BadRequestException && e.message === 'Failed to get private links') {\n    // generic fallback; check server logs and DB connectivity\n  } else throw e;\n}","preventionTips":["Treat the generic message as a server/DB fault, not a client error.","Log the raw rejected value server-side to recover the cause.","Retry once after confirming DB connectivity."],"tags":["private-links","catch-all","api-v2"],"backgroundTag":null,"analyzedSha":"176037d0afbe572f870a3c702985e7cd83fe6c0c","analyzedAt":"2026-08-12T19:12:41.464Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}