{"record":{"id":"3aadcecadaa71960","repo":"calcom/cal.diy","slug":"invalid-connectionid","errorCode":null,"errorMessage":"Invalid connectionId","messagePattern":"Invalid connectionId","errorType":"validation","errorClass":"BadRequestException","httpStatus":400,"severity":"warning","filePath":"apps/api/v2/src/modules/cal-unified-calendars/pipes/parse-connection-id.pipe.ts","lineNumber":8,"sourceCode":"import { BadRequestException, Injectable, PipeTransform } from \"@nestjs/common\";\n\n@Injectable()\nexport class ParseConnectionIdPipe implements PipeTransform<string, number> {\n  transform(value: string): number {\n    const id = parseInt(value, 10);\n    if (Number.isNaN(id)) {\n      throw new BadRequestException(\"Invalid connectionId\");\n    }\n    return id;\n  }\n}\n","sourceCodeStart":1,"sourceCodeEnd":13,"githubUrl":"https://github.com/calcom/cal.diy/blob/176037d0afbe572f870a3c702985e7cd83fe6c0c/apps/api/v2/src/modules/cal-unified-calendars/pipes/parse-connection-id.pipe.ts#L1-L13","documentation":"ParseConnectionIdPipe throws a BadRequestException when parseInt(value, 10) returns NaN — i.e. the connectionId route/param value is not a base-10 integer string. The pipe expects a numeric connection id and converts it to a number before the controller runs.","triggerScenarios":"Hitting a /v2/.../:connectionId/... route with a non-numeric path segment: /v2/cal-unified-calendars/connections/abc/events, or an empty segment, or a float like 12.5.","commonSituations":"Passing a UUID or slug where a numeric id is expected; trailing slash producing an empty param; sending the API's connection name instead of its numeric id.","solutions":["Send the numeric connection id from your connection list (GET the connections endpoint first to discover it).","On the client, coerce/validate the id with `Number.isInteger(Number(x))` before building the URL.","Document/confirm that this route accepts only integer ids, not slugs."],"exampleFix":"// before\nconst url = `/v2/cal-unified-calendars/connections/${slug}/events`;\n\n// after\nif (!Number.isInteger(Number(id))) throw new Error('connectionId must be an integer');\nconst url = `/v2/cal-unified-calendars/connections/${id}/events`;","handlingStrategy":"validation","validationCode":"function isConnectionId(v: unknown): v is number {\n  return typeof v === 'number' && Number.isInteger(v) && v > 0;\n}\nconst id = Number(rawParam);\nif (!isConnectionId(id)) throw new Error('connectionId must be a positive integer');","typeGuard":"function isIntegerString(v: unknown): v is string {\n  return typeof v === 'string' && /^\\d+$/.test(v);\n}","tryCatchPattern":null,"preventionTips":["Always pass the numeric connection id from the connections list endpoint.","Type the client-side path param as number and validate before building the URL.","Document which routes take integer ids vs slugs/UUIDs."],"tags":["validation","pipe","route-param","api-v2"],"backgroundTag":null,"analyzedSha":"176037d0afbe572f870a3c702985e7cd83fe6c0c","analyzedAt":"2026-08-12T19:12:41.464Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}