elastic/elasticsearch · error · IllegalArgumentException
No points have been consumed
Error message
No points have been consumed
What it means
Thrown by StreamingGeometrySimplifier.LineSimplifier.produce() when the simplifier has not consumed any points (length < 1). produce() materializes a Line from the accumulated points; with zero points there is no valid Line to return, so the call is rejected as a usage error.
Source
Thrown at libs/geo/src/main/java/org/elasticsearch/geometry/simplify/StreamingGeometrySimplifier.java:295
return new ArrayList<>(Arrays.asList(points).subList(0, length));
}
/**
* Simplifies a Line geometry to the specified maximum number of points.
*/
public static class LineSimplifier extends StreamingGeometrySimplifier<Line> {
public LineSimplifier(int maxPoints, SimplificationErrorCalculator calculator) {
this(maxPoints, calculator, null);
}
public LineSimplifier(int maxPoints, SimplificationErrorCalculator calculator, Monitor monitor) {
super("Line", maxPoints, calculator, monitor);
}
@Override
public Line produce() {
if (length < 1) {
throw new IllegalArgumentException("No points have been consumed");
}
double[] x = new double[length];
double[] y = new double[length];
for (int i = 0; i < length; i++) {
x[i] = points[i].x;
y[i] = points[i].y;
}
return new Line(x, y);
}
}
/**
* This behaves the same as the <code>LineSimplifier</code> except that it assumes the first and last point are the same point.
* The minimum acceptable polygon size is therefor 4 points.
*/
public static class LinearRingSimplifier extends StreamingGeometrySimplifier<LinearRing> {
public LinearRingSimplifier(int maxPoints, SimplificationErrorCalculator calculator) {
this(maxPoints, calculator, null);View on GitHub (pinned to db6a809a66)
Solutions
- Guard the produce call: only invoke produce() when at least one point has been consumed (check the input source is non-empty first).
- Skip simplification entirely for empty inputs — return the empty Line or null per your contract.
- Validate source geometries have length >= 1 before feeding them to the simplifier.
Example fix
// before var s = new StreamingGeometrySimplifier.LineSimplifier(maxPoints, calc); Line result = s.produce(); // throws — nothing consumed // after var s = new StreamingGeometrySimplifier.LineSimplifier(maxPoints, calc); for (int i = 0; i < xs.length; i++) s.consume(xs[i], ys[i]); Line result = xs.length == 0 ? new Line(new double[0], new double[0]) : s.produce();
Defensive patterns
Strategy: validation
Validate before calling
if (xs == null || xs.length == 0) return new Line(new double[0], new double[0]); var s = new StreamingGeometrySimplifier.LineSimplifier(maxPoints, calc); for (int i = 0; i < xs.length; i++) s.consume(xs[i], ys[i]); return s.produce();
Prevention
- Check the source point array is non-empty before constructing and producing from a LineSimplifier.
- Skip produce() when the consume loop ran zero iterations.
- Validate source Line geometry has length >= 1 upstream.
When it happens
Trigger: Constructing a LineSimplifier, immediately calling .produce() without any preceding .consume(x, y) or .consumePoint() calls; or feeding points that were all filtered/dropped by an internal rule (though normally consumed points still increment length).
Common situations: Empty input geometry (a Line with zero vertices) reaching the simplifier; a streaming pipeline where the source emitted no records before produce was invoked; conditional code paths that skip the consume loop when a list is empty but still call produce.
Related errors
- LinearRing cannot have less than 4 points
- LinearRing cannot have first and last points differ:
- Unsupported geometry type:
- Unknown simplification error calculator:
- max y cannot be less than min y
AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12).
Data as JSON: /api/errors/986fa0d577b269c8.
Report an issue: GitHub.