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

Validation.validateLatitude checks latitude arguments for Redis GEO commands before they are sent to the server. Valid latitudes for Redis geospatial indexing lie in [-85.05112878, 85.05112878] (the Web Mercator limit), so anything outside is rejected locally with IllegalArgumentException. Note the exception message itself is buggy — it prints the same bound twice instead of [-85.05112878, 85.05112878].

Source

Thrown at extensions/redis-client/runtime/src/main/java/io/quarkus/redis/runtime/datasource/Validation.java:109

    static <K, V> void notNullOrEmpty(Map<K, V> map, String name) {
        if (map == null) {
            throw new IllegalArgumentException("`" + name + "` must not be `null`");
        }
        if (map.size() == 0) {
            throw new IllegalArgumentException("`" + name + "` must not be empty");
        }
    }

    static void validateLongitude(double longitude) {
        if (longitude < -180 || longitude > 180) {
            throw new IllegalArgumentException("The longitude must be in [-180, 180]");
        }
    }

    static void validateLatitude(double latitude) {
        if (latitude < -85.05112878 || latitude > 85.05112878) {
            throw new IllegalArgumentException("The latitude must be in [85.05112878, 85.05112878]");
        }
    }

    public static void validateTimeout(Duration value, String name) {
        if (value == null) {
            throw new IllegalArgumentException(String.format("`%s` must not be `null`", name));
        }
        if (value.isNegative()) {
            throw new IllegalArgumentException(String.format("`%s` must be greater than or equal to zero", name));
        }
    }

    public static void positive(double amount, String name) {
        if (amount <= 0) {
            throw new IllegalArgumentException(String.format("`%s` must be greater than zero`", name));
        }
    }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Clamp latitude to [-85.05112878, 85.05112878] before calling the geo API (points at poles cannot be represented in Redis GEO anyway)
  2. Verify latitude and longitude are not swapped in the call
  3. Round the value only if it slightly exceeds the bound due to floating-point noise (e.g. 85.05112878000001)
  4. Reject or relocate such points at data-import time rather than at query time

Example fix

// before
redis.geoadd("cities", 2.35, 90.0, "northpole"); // throws
// after
double lat = 85.05112878; // clamped; note pole is not representable in Redis GEO
redis.geoadd("cities", 2.35, lat, "near-northpole");
Defensive patterns

Strategy: validation

Validate before calling

static boolean isValidLatitude(double lat) { return lat >= -85.05112878 && lat <= 85.05112878; }
if (!isValidLatitude(lat)) throw new IllegalArgumentException("latitude outside Mercator bounds: " + lat);

Try / catch

try { redis.geoadd(key, lon, lat, member); } catch (IllegalArgumentException e) { log.warn("Bad latitude: {}", e.getMessage()); }

Prevention

When it happens

Trigger: Calling geoadd/geosearch/georadius-style APIs on RedisDataSource with a latitude < -85.05112878 or > 85.05112878, e.g. passing a raw +/-90 pole coordinate or a swapped longitude value in the latitude slot.

Common situations: Passing latitude=90 (North Pole) which is valid geography but outside Mercator bounds; swapping lat/lng so a longitude like 151.2 lands in the latitude argument; data imported from coordinate systems with wider latitude ranges.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/8374b906b9613c9b. Report an issue: GitHub.