calcom/cal.diy · warning · BadRequestException
Invalid connectionId
Error message
Invalid connectionId
What it means
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.
Source
Thrown at apps/api/v2/src/modules/cal-unified-calendars/pipes/parse-connection-id.pipe.ts:8
import { BadRequestException, Injectable, PipeTransform } from "@nestjs/common";
@Injectable()
export class ParseConnectionIdPipe implements PipeTransform<string, number> {
transform(value: string): number {
const id = parseInt(value, 10);
if (Number.isNaN(id)) {
throw new BadRequestException("Invalid connectionId");
}
return id;
}
}
View on GitHub (pinned to 176037d0af)
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.
Example fix
// before
const url = `/v2/cal-unified-calendars/connections/${slug}/events`;
// after
if (!Number.isInteger(Number(id))) throw new Error('connectionId must be an integer');
const url = `/v2/cal-unified-calendars/connections/${id}/events`; Defensive patterns
Strategy: validation
Validate before calling
function isConnectionId(v: unknown): v is number {
return typeof v === 'number' && Number.isInteger(v) && v > 0;
}
const id = Number(rawParam);
if (!isConnectionId(id)) throw new Error('connectionId must be a positive integer'); Type guard
function isIntegerString(v: unknown): v is string {
return typeof v === 'string' && /^\d+$/.test(v);
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- ApiKeysService -Cannot set both apiKeyDaysValid and apiKeyNe
- teamId is required for team events, please provide a valid t
- username is required for non-team events, please provide a v
- 'to' must not be before 'from'
- OAuth client with ID '${clientId}' not found
AI-assisted analysis of calcom/cal.diy@176037d0af (2026-08-12).
Data as JSON: /api/errors/3aadcecadaa71960.
Report an issue: GitHub.