{"record":{"id":"453885a159ae0aba","repo":"quarkusio/quarkus","slug":"the-latitude-must-be-in-85-05112878-85-05112878","errorCode":null,"errorMessage":"The latitude must be in [85.05112878, 85.05112878]","messagePattern":"The latitude must be in \\[85\\.05112878, 85\\.05112878\\]","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/redis-client/runtime/src/main/java/io/quarkus/redis/datasource/geo/GeoPosition.java","lineNumber":26,"sourceCode":" * <li>Valid longitudes are from -180 to 180 degrees.</li>\n * <li>Valid latitudes are from -85.05112878 to 85.05112878 degrees.</li>\n * </ul>\n */\npublic class GeoPosition {\n\n    public final double longitude;\n    public final double latitude;\n\n    public static GeoPosition of(double longitude, double latitude) {\n        return new GeoPosition(longitude, latitude);\n    }\n\n    private GeoPosition(double longitude, double latitude) {\n        if (longitude < -180 || longitude > 180) {\n            throw new IllegalArgumentException(\"The longitude must be in [-180, 180]\");\n        }\n        if (latitude < -85.05112878 || latitude > 85.05112878) {\n            throw new IllegalArgumentException(\"The latitude must be in [85.05112878, 85.05112878]\");\n        }\n        this.longitude = longitude;\n        this.latitude = latitude;\n    }\n\n    public double longitude() {\n        return longitude;\n    }\n\n    public double latitude() {\n        return latitude;\n    }\n}\n","sourceCodeStart":8,"sourceCodeEnd":40,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/datasource/geo/GeoPosition.java#L8-L40","documentation":"GeoPosition.of validates that latitude lies within the Mercator-projection bounds Redis uses, ±85.05112878 degrees; values outside throw this IllegalArgumentException. Note the error message is itself buggy — it prints the same bound twice and omits the negative bound — but the actual accepted range is [-85.05112878, 85.05112878].","triggerScenarios":"Calling GeoPosition.of(lon, 86) or any latitude outside ±85.05112878 — e.g. passing longitude-range values (±180) as latitudes, or polar coordinates (±90) which exceed the Web-Mercator limit even though they are valid WGS-84 latitudes.","commonSituations":"Data containing legitimate polar coordinates (above ~85°N, e.g. Svalbard or the poles) that Redis GEO cannot index; lat/lon argument swaps; naive validation code that allows ±90 because that is the true geographic latitude range.","solutions":["Clamp latitude to ±85.05112878 before constructing, understanding this distorts positions near the poles.","Reject or special-case data points beyond the Mercator bounds (store them outside Redis GEO, e.g. by geohash).","Check argument order: GeoPosition.of takes (longitude, latitude)."],"exampleFix":"// before\nGeoPosition pos = GeoPosition.of(10.7, 90.0); // North Pole -> throws\n// after\ndouble lat = Math.max(-85.05112878, Math.min(85.05112878, 89.9));\nGeoPosition pos = GeoPosition.of(10.7, lat);","handlingStrategy":"validation","validationCode":"double MERCATOR_MAX = 85.05112878;\nif (lat < -MERCATOR_MAX || lat > MERCATOR_MAX) {\n    throw new IllegalArgumentException(\"latitude \" + lat + \" exceeds Web-Mercator bounds ±85.05112878\");\n}\nGeoPosition.of(lon, lat);","typeGuard":"boolean isValidLatitude(double lat) { return Double.isFinite(lat) && Math.abs(lat) <= 85.05112878; }","tryCatchPattern":"try { return GeoPosition.of(lon, lat); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"latitude\")) { // clamp or reroute polar points\n  return GeoPosition.of(lon, Math.signum(lat) * 85.05112878); } throw e; }","preventionTips":["Know the real bound is ±85.05112878 — the exception message is misleading (prints the same bound twice).","Special-case polar data (|lat| > 85.05) outside Redis GEO or clamp knowingly.","Don't assume ±90 is valid; Redis GEO uses Web-Mercator bounds."],"tags":["redis","geo","coordinate-validation"],"backgroundTag":"invalid-coordinate-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"}