{"record":{"id":"027d7e329a8531cf","repo":"koala73/worldmonitor","slug":"airport-delay-page-size-must-be-0","errorCode":null,"errorMessage":"Airport delay page_size must be 0","messagePattern":"Airport delay page_size must be 0","errorType":"http","errorClass":"ApiError","httpStatus":400,"severity":"error","filePath":"server/worldmonitor/aviation/v1/list-airport-delays.ts","lineNumber":46,"sourceCode":"\nconst FAA_CACHE_KEY = 'aviation:delays:faa:v1';\nconst INTL_CACHE_KEY = 'aviation:delays:intl:v3';\n\nconst FAA_AIRPORT_SET = new Set(FAA_AIRPORTS);\nconst INTL_AIRPORT_SET = new Set(AVIATIONSTACK_AIRPORTS);\n\nconst ALLOWED_QUERY_PARAMS = new Set(['page_size', 'cursor', 'region', 'min_severity', 'jmespath', '_debug', 'rpc']);\n\nexport async function listAirportDelays(\n  ctx: ServerContext,\n  req: ListAirportDelaysRequest,\n): Promise<ListAirportDelaysResponse> {\n  const seenParams = new Set<string>();\n  for (const [key, value] of new URL(ctx.request.url).searchParams) {\n    if (!ALLOWED_QUERY_PARAMS.has(key)) throw new ApiError(400, `Unsupported airport delay parameter: ${key}`, '');\n    if (seenParams.has(key)) throw new ApiError(400, `Duplicate airport delay parameter: ${key}`, '');\n    seenParams.add(key);\n    if (key === 'page_size' && value !== '0') throw new ApiError(400, 'Airport delay page_size must be 0', '');\n    if (key === 'rpc' && value !== 'list-airport-delays') throw new ApiError(400, 'Invalid airport delay route', '');\n  }\n  if ((req.pageSize ?? 0) !== 0 || req.cursor\n    || (req.region && req.region !== 'AIRPORT_REGION_UNSPECIFIED')\n    || (req.minSeverity && req.minSeverity !== 'FLIGHT_DELAY_SEVERITY_UNSPECIFIED')) {\n    throw new ApiError(400, 'Airport delay filters are not supported', '');\n  }\n  // 1. FAA (US) — seed-only read\n  // faaSourceCovered = the seed cache hit AND returned a valid alerts array.\n  // A miss/parse-error means we have no telemetry for any FAA airport this\n  // tick — we MUST NOT publish synthetic \"normal\" rows for them. See #3707.\n  // PERF: the three inputs below are independent (different Redis keys / an\n  // independent fetcher) and merge only afterwards — start them concurrently\n  // instead of paying three serial round-trips per request.\n  const faaRead = (async (): Promise<{ faaAlerts: AirportDelayAlert[]; faaSourceCovered: boolean; available: boolean }> => {\n    let faaAlerts: AirportDelayAlert[] = [];\n    let faaSourceCovered = false;\n    try {","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/koala73/worldmonitor/blob/e586b8b4b80f595aa7ece295eec10d76f2921240/server/worldmonitor/aviation/v1/list-airport-delays.ts#L28-L64","documentation":"This endpoint returns the full seed-only airport delay listing and intentionally disallows pagination: page_size must be the literal string '0'. Any other value triggers ApiError 400 so clients cannot request paged results the backing seed cache cannot provide.","triggerScenarios":"GET .../list-airport-delays?page_size=0&rpc=... works; ?page_size=25, ?page_size=10, or any non-'0' string throws.","commonSituations":"Generic API clients that always send a page_size; copied code from other list endpoints that support pagination; SDK defaults injecting page_size.","solutions":["Omit page_size entirely from the request URL","If page_size must be sent, send the exact value '0'","Remove client-side pagination logic and consume the full response","Check for an SDK/config default that injects page_size and disable it"],"exampleFix":"// before\nconst params = new URLSearchParams({ rpc: 'list-airport-delays', page_size: '25' });\n// after\nconst params = new URLSearchParams({ rpc: 'list-airport-delays', page_size: '0' });","handlingStrategy":"validation","validationCode":"if (params.has('page_size') && params.get('page_size') !== '0') throw new Error('page_size must be 0');","typeGuard":"const isPagedRequest = (p) => 'page_size' in p && String(p.page_size) !== '0';","tryCatchPattern":"try { await listAirportDelays(ctx, req); } catch (e) { if (e instanceof ApiError && e.status === 400 && e.message.includes('page_size must be 0')) { retryWithPageSizeZero(); } else throw e; }","preventionTips":["Never send page_size to this endpoint","Disable SDK default pagination for seed-only endpoints","Grep client code for page_size usage against this route","Document the no-pagination contract in the client API wrapper"],"tags":["http","validation","pagination"],"backgroundTag":"invalid-query-parameter","analyzedSha":"e586b8b4b80f595aa7ece295eec10d76f2921240","analyzedAt":"2026-09-22T01:50:49.965Z","contentChangedAt":"2026-09-22T01:50:49.965Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}