elastic/elasticsearch · error · IllegalArgumentException
max y cannot be less than min y
Error message
max y cannot be less than min y
What it means
Thrown by the default GeometryValidator.validateBBox method when maxY < minY. This default applies to any CRS because an inverted y-range is never geometrically valid. The default deliberately does NOT check x-ordering, because geographic coordinates legitimately allow minX > maxX (antimeridian crossing); only CartesianValidator overrides to add the x-check.
Source
Thrown at libs/geo/src/main/java/org/elasticsearch/geometry/utils/GeometryValidator.java:42
void validate(Geometry geometry);
/**
* Validates a single coordinate and throws IllegalArgumentException if it is not valid.
* Default implementation is a no-op.
*/
default void validateCoordinate(double x, double y, double z) {}
/**
* Validates the ordinate ordering of a rectangle/envelope, throwing IllegalArgumentException if the
* envelope is invalid. The default implementation only checks that maxY is not less than minY, since that
* is always invalid, regardless of CRS. It deliberately does not check x-ordinate ordering: geographic
* coordinates allow minX to legitimately exceed maxX, to represent an envelope that crosses the
* antimeridian, so only implementations for CRSes without that concept (e.g. {@link CartesianValidator})
* need to additionally check that maxX is not less than minX.
*/
default void validateBBox(double minX, double maxX, double maxY, double minY) {
if (maxY < minY) {
throw new IllegalArgumentException("max y cannot be less than min y");
}
}
}
View on GitHub (pinned to db6a809a66)
Solutions
- Pass arguments in (minX, maxX, maxY, minY) order with maxY >= minY.
- Normalize the bounds before validating: `double lo = Math.min(y1, y2); double hi = Math.max(y1, y2);`
- If the input truly represents an inverted envelope (rare for y), no Rectangle/bbox can express it — restructure.
Example fix
// before validator.validateBBox(0, 10, -20, 20); // maxY(-20) < minY(20) // after validator.validateBBox(0, 10, 20, -20); // maxY(20) >= minY(-20)
Defensive patterns
Strategy: validation
Validate before calling
double lo = Math.min(y1, y2); double hi = Math.max(y1, y2); validator.validateBBox(minX, maxX, hi, lo);
Prevention
- Normalize y-ordinate pairs with Math.min/Math.max before validateBBox.
- Pass arguments in (minX, maxX, maxY, minY) order — maxY precedes minY.
- Wrap bbox validation in a helper that accepts unordered corners.
When it happens
Trigger: Calling `validator.validateBBox(minX, maxX, maxY, minY)` on any GeometryValidator (default or override that calls super) where maxY < minY. The default implementation runs in GeographyValidator, which delegates to this default for bbox.
Common situations: Argument-order mistakes (the signature passes maxY before minY); inverted bounding boxes from upstream computations; user-supplied bbox parameters with swapped corners.
Related errors
- max x cannot be less than min x
- invalid latitude
- invalid longitude
- max y cannot be less than min y
- only one z value is specified
AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12).
Data as JSON: /api/errors/24c79b8f6cd0e8ce.
Report an issue: GitHub.