koala73/worldmonitor · error · BboxValidationError
bbox invalid: sw corner must be south-west of ne corner
Error message
bbox invalid: sw corner must be south-west of ne corner
What it means
Bbox geometric validation in extractAndValidateBbox: both corners are individually in-domain but the sw corner is not actually south-west of the ne corner (lat/lon ordering inverted). The bbox would define an empty or inverted rectangle, so it is rejected.
Source
Thrown at server/worldmonitor/maritime/v1/get-vessel-snapshot.ts:317
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),
Boolean(req.includeTankers),
bbox,
);View on GitHub (pinned to eeab0a219f)
Solutions
- Swap or correct the corner ordering so swLat <= neLat and swLon <= neLon
- Normalize bbox corners from the map selection before building the request
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at server/worldmonitor/maritime/v1/get-vessel-snapshot.ts:317 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/41acaca5e8904efa.
Report an issue: GitHub.