{"record":{"id":"5808b07ca5d60828","repo":"quarkusio/quarkus","slug":"the-longitude-must-be-in-180-180-5808b0","errorCode":null,"errorMessage":"The longitude must be in [-180, 180]","messagePattern":"The longitude must be in \\[-180, 180\\]","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/redis-client/runtime/src/main/java/io/quarkus/redis/runtime/datasource/Validation.java","lineNumber":103,"sourceCode":"            throw new IllegalArgumentException(\"`\" + name + \"` must not be `null`\");\n        }\n        if (col.size() == 0) {\n            throw new IllegalArgumentException(\"`\" + name + \"` must not be empty\");\n        }\n    }\n\n    static <K, V> void notNullOrEmpty(Map<K, V> map, String name) {\n        if (map == null) {\n            throw new IllegalArgumentException(\"`\" + name + \"` must not be `null`\");\n        }\n        if (map.size() == 0) {\n            throw new IllegalArgumentException(\"`\" + name + \"` must not be empty\");\n        }\n    }\n\n    static void validateLongitude(double longitude) {\n        if (longitude < -180 || longitude > 180) {\n            throw new IllegalArgumentException(\"The longitude must be in [-180, 180]\");\n        }\n    }\n\n    static void validateLatitude(double latitude) {\n        if (latitude < -85.05112878 || latitude > 85.05112878) {\n            throw new IllegalArgumentException(\"The latitude must be in [85.05112878, 85.05112878]\");\n        }\n    }\n\n    public static void validateTimeout(Duration value, String name) {\n        if (value == null) {\n            throw new IllegalArgumentException(String.format(\"`%s` must not be `null`\", name));\n        }\n        if (value.isNegative()) {\n            throw new IllegalArgumentException(String.format(\"`%s` must be greater than or equal to zero\", name));\n        }\n    }\n","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/runtime/datasource/Validation.java#L85-L121","documentation":"Validation.validateLongitude is a pre-flight argument check used by the Quarkus Redis datasource before sending GEO commands (GEOADD, GEOSEARCH, etc.) to Redis. Redis geospatial operations encode coordinates with a finite valid range, so a longitude outside [-180, 180] is rejected locally with IllegalArgumentException instead of producing an opaque server-side error.","triggerScenarios":"Calling any geo API on a RedisDataSource / ReactiveRedisDataSource (e.g. geoadd(key, longitude, latitude, member), geosearch, geopos inputs) with a hardcoded or computed longitude value less than -180 or greater than 180, often from mixed DMS/decimal data or sign/order swaps of lat/lng.","commonSituations":"Swapping latitude and longitude when importing CSV/GPS data; using degrees-minutes-seconds without converting to decimal degrees; parsing '180.000001' from floating point accumulation; feeding raw GPS NMEA values.","solutions":["Clamp or validate the longitude into [-180, 180] before calling the Redis geo API","Check that longitude and latitude arguments are not swapped (longitude comes first in the API)","Convert any DMS (degrees/minutes/seconds) coordinates to decimal degrees before the call","Normalize out-of-range values with wrapping ((lon + 180) % 360 + 360) % 360 - 180 if wraparound is semantically acceptable"],"exampleFix":"// before\nredis.geoadd(\"cities\", -190.5, 45.5, \"paris\");\n// after\ndouble lon = Math.max(-180, Math.min(180, -190.5)); // or fix the source data\nredis.geoadd(\"cities\", lon, 45.5, \"paris\");","handlingStrategy":"validation","validationCode":"if (lon < -180 || lon > 180) throw new IllegalArgumentException(\"longitude out of range: \" + lon);\ndouble normalized = ((lon + 180) % 360 + 360) % 360 - 180; // wrap if acceptable","typeGuard":null,"tryCatchPattern":"try { redis.geoadd(key, lon, lat, member); } catch (IllegalArgumentException e) { log.warn(\"Bad coordinate: {}\", e.getMessage()); }","preventionTips":["Validate coordinates at data-ingestion time","Keep longitude first in mind: API order is (longitude, latitude)","Store coordinates as decimal degrees only","Add unit tests for boundary values -180, 0, 180"],"tags":["redis","validation","illegal-argument","geospatial"],"backgroundTag":"invalid-argument-range","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}