quarkusio/quarkus · error · IllegalArgumentException
The latitude must be in [85.05112878, 85.05112878]
Error message
The latitude must be in [85.05112878, 85.05112878]
What it means
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].
Source
Thrown at extensions/redis-client/runtime/src/main/java/io/quarkus/redis/datasource/geo/GeoPosition.java:26
* <li>Valid longitudes are from -180 to 180 degrees.</li>
* <li>Valid latitudes are from -85.05112878 to 85.05112878 degrees.</li>
* </ul>
*/
public class GeoPosition {
public final double longitude;
public final double latitude;
public static GeoPosition of(double longitude, double latitude) {
return new GeoPosition(longitude, latitude);
}
private GeoPosition(double longitude, double latitude) {
if (longitude < -180 || longitude > 180) {
throw new IllegalArgumentException("The longitude must be in [-180, 180]");
}
if (latitude < -85.05112878 || latitude > 85.05112878) {
throw new IllegalArgumentException("The latitude must be in [85.05112878, 85.05112878]");
}
this.longitude = longitude;
this.latitude = latitude;
}
public double longitude() {
return longitude;
}
public double latitude() {
return latitude;
}
}
View on GitHub (pinned to e1c734241f)
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).
Example fix
// before GeoPosition pos = GeoPosition.of(10.7, 90.0); // North Pole -> throws // after double lat = Math.max(-85.05112878, Math.min(85.05112878, 89.9)); GeoPosition pos = GeoPosition.of(10.7, lat);
Defensive patterns
Strategy: validation
Validate before calling
double MERCATOR_MAX = 85.05112878;
if (lat < -MERCATOR_MAX || lat > MERCATOR_MAX) {
throw new IllegalArgumentException("latitude " + lat + " exceeds Web-Mercator bounds ±85.05112878");
}
GeoPosition.of(lon, lat); Type guard
boolean isValidLatitude(double lat) { return Double.isFinite(lat) && Math.abs(lat) <= 85.05112878; } Try / catch
try { return GeoPosition.of(lon, lat); } catch (IllegalArgumentException e) { if (e.getMessage().contains("latitude")) { // clamp or reroute polar points
return GeoPosition.of(lon, Math.signum(lat) * 85.05112878); } throw e; } Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- The longitude must be in [-180, 180]
- Cannot set XX and NX together
- ANY can only be used if COUNT is also set
- ANY can only be used if COUNT is also set
- At least `STORE` or `STOREDIST` must be set
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/453885a159ae0aba.
Report an issue: GitHub.