{"record":{"id":"fd8b71d82ecea60c","repo":"koala73/worldmonitor","slug":"bbox-invalid-ne-corner-outside-lat-lon-domain-9","errorCode":null,"errorMessage":"bbox invalid: ne corner outside lat/lon domain (-90..90 / -180..180)","messagePattern":"bbox invalid: ne corner outside lat/lon domain \\(-90\\.\\.90 / -180\\.\\.180\\)","errorType":"validation","errorClass":"BboxValidationError","httpStatus":400,"severity":"error","filePath":"server/worldmonitor/maritime/v1/get-vessel-snapshot.ts","lineNumber":314,"sourceCode":"function isValidLatLon(lat: number, lon: number): boolean {\n  return (\n    Number.isFinite(lat) && Number.isFinite(lon) &&\n    lat >= -90 && lat <= 90 && lon >= -180 && lon <= 180\n  );\n}\n\nfunction extractAndValidateBbox(req: GetVesselSnapshotRequest): { swLat: number; swLon: number; neLat: number; neLon: number } | null {\n  const sw = { lat: Number(req.swLat), lon: Number(req.swLon) };\n  const ne = { lat: Number(req.neLat), lon: Number(req.neLon) };\n  // All zeroes (the default for unset proto doubles) → no bbox.\n  if (sw.lat === 0 && sw.lon === 0 && ne.lat === 0 && ne.lon === 0) {\n    return null;\n  }\n  if (!isValidLatLon(sw.lat, sw.lon)) {\n    throw new BboxValidationError('sw corner outside lat/lon domain (-90..90 / -180..180)');\n  }\n  if (!isValidLatLon(ne.lat, ne.lon)) {\n    throw new BboxValidationError('ne corner outside lat/lon domain (-90..90 / -180..180)');\n  }\n  if (sw.lat > ne.lat || sw.lon > ne.lon) {\n    throw new BboxValidationError('sw corner must be south-west of ne corner');\n  }\n  if (ne.lat - sw.lat > MAX_BBOX_DEGREES || ne.lon - sw.lon > MAX_BBOX_DEGREES) {\n    throw new BboxValidationError(`each dimension must be ≤ ${MAX_BBOX_DEGREES} degrees`);\n  }\n  return { swLat: sw.lat, swLon: sw.lon, neLat: ne.lat, neLon: ne.lon };\n}\n\nexport async function getVesselSnapshot(\n  _ctx: ServerContext,\n  req: GetVesselSnapshotRequest,\n): Promise<GetVesselSnapshotResponse> {\n  try {\n    const bbox = extractAndValidateBbox(req);\n    const snapshot = await fetchVesselSnapshot(\n      Boolean(req.includeCandidates),","sourceCodeStart":296,"sourceCodeEnd":332,"githubUrl":"https://github.com/koala73/worldmonitor/blob/eeab0a219fce0f02a00603b532dbae9041b934ac/server/worldmonitor/maritime/v1/get-vessel-snapshot.ts#L296-L332","documentation":"Bbox validation in extractAndValidateBbox (vessel snapshot): the northeast corner lat/lon is non-finite or outside the geographic domain (lat -90..90, lon -180..180). The sw corner already passed; only the ne corner values are at fault.","triggerScenarios":"Thrown at server/worldmonitor/maritime/v1/get-vessel-snapshot.ts:314 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the neLat/neLon values in the request to finite values within the domain","Clamp map-derived ne corners to the domain before sending the request"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"eeab0a219fce0f02a00603b532dbae9041b934ac","analyzedAt":"2026-08-21T16:51:25.751Z","contentChangedAt":"2026-08-21T16:51:25.751Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}