koala73/worldmonitor · error · BboxValidationError
bbox invalid: sw corner outside lat/lon domain (-90..90 / -1
Error message
bbox invalid: sw corner outside lat/lon domain (-90..90 / -180..180)
What it means
Bbox validation in extractAndValidateBbox (vessel snapshot): the southwest corner lat/lon is non-finite or outside the geographic domain (lat -90..90, lon -180..180). An all-zero bbox is treated as 'no bbox', so reaching this throw means a genuinely invalid sw corner was supplied in the request.
Source
Thrown at server/worldmonitor/maritime/v1/get-vessel-snapshot.ts:311
// Prefer BboxValidationError for new code.
export const BboxTooLargeError = BboxValidationError;
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 {View on GitHub (pinned to eeab0a219f)
Solutions
- Fix the swLat/swLon values in the request to finite values within the domain
- Validate bbox corners client-side (map bounds) before requesting a vessel snapshot
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at server/worldmonitor/maritime/v1/get-vessel-snapshot.ts:311 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/f336d992563d5022.
Report an issue: GitHub.