{"record":{"id":"2c3e19922d5fa785","repo":"apache/flink","slug":"the-iteration-has-no-input-initial-partial-sol","errorCode":null,"errorMessage":"The iteration {} has no input (initial partial solution).","messagePattern":"The iteration (.+?) has no input \\(initial partial solution\\)\\.","errorType":"validation","errorClass":"InvalidProgramException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/api/common/operators/CollectionExecutor.java","lineNumber":325,"sourceCode":"\n            for (Map.Entry<String, Operator<?>> bcInputs :\n                    operator.getBroadcastInputs().entrySet()) {\n                List<?> bcData = execute(bcInputs.getValue(), jobInfo);\n                ctx.setBroadcastVariable(bcInputs.getKey(), bcData);\n            }\n        } else {\n            ctx = null;\n        }\n\n        return typedOp.executeOnCollections(inputData1, inputData2, ctx, executionConfig);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private <T> List<T> executeBulkIteration(BulkIterationBase<?> iteration, JobInfo jobInfo)\n            throws Exception {\n        Operator<?> inputOp = iteration.getInput();\n        if (inputOp == null) {\n            throw new InvalidProgramException(\n                    \"The iteration \"\n                            + iteration.getName()\n                            + \" has no input (initial partial solution).\");\n        }\n        if (iteration.getNextPartialSolution() == null) {\n            throw new InvalidProgramException(\n                    \"The iteration \"\n                            + iteration.getName()\n                            + \" has no next partial solution defined (is not closed).\");\n        }\n\n        List<T> inputData = (List<T>) execute(inputOp, jobInfo);\n\n        // get the operators that are iterative\n        Set<Operator<?>> dynamics = new LinkedHashSet<Operator<?>>();\n        DynamicPathCollector dynCollector = new DynamicPathCollector(dynamics);\n        iteration.getNextPartialSolution().accept(dynCollector);\n        if (iteration.getTerminationCriterion() != null) {","sourceCodeStart":307,"sourceCodeEnd":343,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/api/common/operators/CollectionExecutor.java#L307-L343","documentation":"Thrown by CollectionExecutor.executeBulkIteration() when iteration.getInput() returns null. Bulk iterations require an initial partial solution (the seed data for the iteration loop); without it, the iteration has no starting point. This is an InvalidProgramException indicating the iteration was not fully constructed.","triggerScenarios":"A BulkIterationBase operator is created but its initial input (the initial partial solution) was never set. In the high-level API, this happens if the DataSet passed to iterate() is null, or if the iteration operator was built programmatically without calling setInput().","commonSituations":"A developer creates a bulk iteration but the initial DataSet variable is null because the source read or preceding transformation that should feed it failed or was skipped. Rare in normal API usage since iterate() accepts a DataSet; more common in low-level plan construction.","solutions":["Ensure the initial input DataSet for the iteration is non-null before calling iterate().","Verify the source transformation feeding the iteration (e.g., env.fromCollection()) returns a valid DataSet.","Print the execution plan to confirm the iteration's input is wired."],"exampleFix":"// before — initialDataSet is null\nDataSet<Long> initialDataSet = null;\nIterativeDataSet<Long> iter = initialDataSet.iterate(100);\n// after\nDataSet<Long> initialDataSet = env.fromSequence(0, 100);\nIterativeDataSet<Long> iter = initialDataSet.iterate(100);","handlingStrategy":"validation","validationCode":"// Ensure initial partial solution is non-null\nif (initialDataSet == null) {\n    throw new IllegalStateException(\"Initial input for bulk iteration is null\");\n}\nIterativeDataSet<Long> iter = initialDataSet.iterate(100);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify the initial DataSet for iterate() is sourced from a valid source transformation.","Print the execution plan to confirm the iteration's input is connected.","Avoid null-producing conditional assignments for iteration seed data."],"tags":["iteration","bulk-iteration","plan-validation","collection-executor","flink-core"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}