{"record":{"id":"986fa0d577b269c8","repo":"elastic/elasticsearch","slug":"no-points-have-been-consumed","errorCode":null,"errorMessage":"No points have been consumed","messagePattern":"No points have been consumed","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"libs/geo/src/main/java/org/elasticsearch/geometry/simplify/StreamingGeometrySimplifier.java","lineNumber":295,"sourceCode":"        return new ArrayList<>(Arrays.asList(points).subList(0, length));\n    }\n\n    /**\n     * Simplifies a Line geometry to the specified maximum number of points.\n     */\n    public static class LineSimplifier extends StreamingGeometrySimplifier<Line> {\n        public LineSimplifier(int maxPoints, SimplificationErrorCalculator calculator) {\n            this(maxPoints, calculator, null);\n        }\n\n        public LineSimplifier(int maxPoints, SimplificationErrorCalculator calculator, Monitor monitor) {\n            super(\"Line\", maxPoints, calculator, monitor);\n        }\n\n        @Override\n        public Line produce() {\n            if (length < 1) {\n                throw new IllegalArgumentException(\"No points have been consumed\");\n            }\n            double[] x = new double[length];\n            double[] y = new double[length];\n            for (int i = 0; i < length; i++) {\n                x[i] = points[i].x;\n                y[i] = points[i].y;\n            }\n            return new Line(x, y);\n        }\n    }\n\n    /**\n     * This behaves the same as the <code>LineSimplifier</code> except that it assumes the first and last point are the same point.\n     * The minimum acceptable polygon size is therefor 4 points.\n     */\n    public static class LinearRingSimplifier extends StreamingGeometrySimplifier<LinearRing> {\n        public LinearRingSimplifier(int maxPoints, SimplificationErrorCalculator calculator) {\n            this(maxPoints, calculator, null);","sourceCodeStart":277,"sourceCodeEnd":313,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/libs/geo/src/main/java/org/elasticsearch/geometry/simplify/StreamingGeometrySimplifier.java#L277-L313","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"// before\nvar s = new StreamingGeometrySimplifier.LineSimplifier(maxPoints, calc);\nLine result = s.produce(); // throws — nothing consumed\n\n// after\nvar s = new StreamingGeometrySimplifier.LineSimplifier(maxPoints, calc);\nfor (int i = 0; i < xs.length; i++) s.consume(xs[i], ys[i]);\nLine result = xs.length == 0 ? new Line(new double[0], new double[0]) : s.produce();","handlingStrategy":"validation","validationCode":"if (xs == null || xs.length == 0) return new Line(new double[0], new double[0]);\nvar s = new StreamingGeometrySimplifier.LineSimplifier(maxPoints, calc);\nfor (int i = 0; i < xs.length; i++) s.consume(xs[i], ys[i]);\nreturn s.produce();","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["geometry","simplification","streaming","line","empty-state","usage-error","libs-geo"],"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T12:17:08.281Z"}