koala73/worldmonitor · error · BboxValidationError

bbox invalid: ne corner outside lat/lon domain (-90..90 / -1

Error message

bbox invalid: ne corner outside lat/lon domain (-90..90 / -180..180)

What it means

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.

Source

Thrown at server/worldmonitor/maritime/v1/get-vessel-snapshot.ts:314

function isValidLatLon(lat: number, lon: number): boolean {
  return (
    Number.isFinite(lat) && Number.isFinite(lon) &&
    lat >= -90 && lat <= 90 && lon >= -180 && lon <= 180
  );
}

function extractAndValidateBbox(req: GetVesselSnapshotRequest): { swLat: number; swLon: number; neLat: number; neLon: number } | null {
  const sw = { lat: Number(req.swLat), lon: Number(req.swLon) };
  const ne = { lat: Number(req.neLat), lon: Number(req.neLon) };
  // All zeroes (the default for unset proto doubles) → no bbox.
  if (sw.lat === 0 && sw.lon === 0 && ne.lat === 0 && ne.lon === 0) {
    return null;
  }
  if (!isValidLatLon(sw.lat, sw.lon)) {
    throw new BboxValidationError('sw corner outside lat/lon domain (-90..90 / -180..180)');
  }
  if (!isValidLatLon(ne.lat, ne.lon)) {
    throw new BboxValidationError('ne corner outside lat/lon domain (-90..90 / -180..180)');
  }
  if (sw.lat > ne.lat || sw.lon > ne.lon) {
    throw new BboxValidationError('sw corner must be south-west of ne corner');
  }
  if (ne.lat - sw.lat > MAX_BBOX_DEGREES || ne.lon - sw.lon > MAX_BBOX_DEGREES) {
    throw new BboxValidationError(`each dimension must be ≤ ${MAX_BBOX_DEGREES} degrees`);
  }
  return { swLat: sw.lat, swLon: sw.lon, neLat: ne.lat, neLon: ne.lon };
}

export async function getVesselSnapshot(
  _ctx: ServerContext,
  req: GetVesselSnapshotRequest,
): Promise<GetVesselSnapshotResponse> {
  try {
    const bbox = extractAndValidateBbox(req);
    const snapshot = await fetchVesselSnapshot(
      Boolean(req.includeCandidates),

View on GitHub (pinned to eeab0a219f)

Solutions

  1. Fix the neLat/neLon values in the request to finite values within the domain
  2. Clamp map-derived ne corners to the domain before sending the request
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at server/worldmonitor/maritime/v1/get-vessel-snapshot.ts:314 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of koala73/worldmonitor@eeab0a219f (2026-08-21). Data as JSON: /api/errors/fd8b71d82ecea60c. Report an issue: GitHub.