{"record":{"id":"6b7a9c4d4c2f727f","repo":"apache/flink","slug":"the-iteration-has-no-solution-set-delta-defined","errorCode":null,"errorMessage":"The iteration {} has no solution set delta defined (is not closed).","messagePattern":"The iteration (.+?) has no solution set delta defined \\(is not closed\\)\\.","errorType":"validation","errorClass":"InvalidProgramException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/api/common/operators/CollectionExecutor.java","lineNumber":418,"sourceCode":"\n        return currentResult;\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private <T> List<T> executeDeltaIteration(DeltaIterationBase<?, ?> iteration, JobInfo jobInfo)\n            throws Exception {\n        Operator<?> solutionInput = iteration.getInitialSolutionSet();\n        Operator<?> worksetInput = iteration.getInitialWorkset();\n        if (solutionInput == null) {\n            throw new InvalidProgramException(\n                    \"The delta iteration \" + iteration.getName() + \" has no initial solution set.\");\n        }\n        if (worksetInput == null) {\n            throw new InvalidProgramException(\n                    \"The delta iteration \" + iteration.getName() + \" has no initial workset.\");\n        }\n        if (iteration.getSolutionSetDelta() == null) {\n            throw new InvalidProgramException(\n                    \"The iteration \"\n                            + iteration.getName()\n                            + \" has no solution set delta defined (is not closed).\");\n        }\n        if (iteration.getNextWorkset() == null) {\n            throw new InvalidProgramException(\n                    \"The iteration \"\n                            + iteration.getName()\n                            + \" has no workset defined (is not closed).\");\n        }\n\n        List<T> solutionInputData = (List<T>) execute(solutionInput, jobInfo);\n        List<T> worksetInputData = (List<T>) execute(worksetInput, jobInfo);\n\n        // get the operators that are iterative\n        Set<Operator<?>> dynamics = new LinkedHashSet<Operator<?>>();\n        DynamicPathCollector dynCollector = new DynamicPathCollector(dynamics);\n        iteration.getSolutionSetDelta().accept(dynCollector);","sourceCodeStart":400,"sourceCodeEnd":436,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/api/common/operators/CollectionExecutor.java#L400-L436","documentation":"Thrown by CollectionExecutor.executeDeltaIteration() when iteration.getSolutionSetDelta() returns null. The solution set delta is the operator that produces the changes to the solution set each iteration; a null value means the delta iteration was never 'closed' — the developer forgot to call closeWith(solutionSetDelta, nextWorkset). This is an InvalidProgramException.","triggerScenarios":"Creating a delta iteration via iterateDelta() but never calling closeWith() with the solution set delta. The step function body is defined but the loop is not terminated, leaving getSolutionSetDelta() as null.","commonSituations":"A developer writes a delta iterative algorithm, defines the step function, but forgets or incorrectly calls closeWith(). Delta iterations require closeWith(solutionSetDelta, nextWorkset) with two arguments, unlike bulk iterations which take one. Forgetting the two-argument form is a common mistake.","solutions":["Call iter.closeWith(solutionSetDelta, nextWorkset) to close the delta iteration with both the delta and the next workset.","Verify that the solutionSetDelta DataSet and nextWorkset DataSet are correctly produced by the step function body.","Review the delta iteration structure: iterateDelta() → define step body → closeWith(delta, nextWorkset) → use the returned DataSet."],"exampleFix":"// before — delta iteration never closed\nDeltaIteration<S,W> iter = solutionSet.iterateDelta(workset, 100, 0);\nDataSet<S> delta = iter.getWorkset().join(solutionSet).where(0).equalTo(0);\n// missing: DataSet<S> result = iter.closeWith(delta, nextWorkset);\n// after\nDataSet<S> delta = iter.getWorkset().join(solutionSet).where(0).equalTo(0);\nDataSet<W> nextWorkset = delta.project(0);\nDataSet<S> result = iter.closeWith(delta, nextWorkset);","handlingStrategy":"validation","validationCode":"// Ensure delta iteration is fully closed with solution set delta\nDeltaIteration<S,W> iter = solutionSet.iterateDelta(workset, 100, 0);\nDataSet<S> delta = computeDelta(iter);\nDataSet<W> nextWorkset = computeNextWorkset(iter);\nif (delta == null || nextWorkset == null) {\n    throw new IllegalStateException(\"Delta iteration step results must not be null\");\n}\nDataSet<S> result = iter.closeWith(delta, nextWorkset); // required call","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always call closeWith(solutionSetDelta, nextWorkset) — the two-argument form — for delta iterations.","Verify that the solution set delta DataSet is produced by the step body and is non-null.","Review the delta iteration close pattern: iterateDelta() → step body → closeWith(delta, nextWorkset)."],"tags":["iteration","delta-iteration","plan-validation","closewith","flink-core"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}