apache/flink · error · InvalidProgramException

The delta iteration {} has no initial workset.

Error message

The delta iteration {} has no initial workset.

What it means

Thrown by CollectionExecutor.executeDeltaIteration() when iteration.getInitialWorkset() returns null. Delta iterations need both an initial solution set (checked first) and an initial workset. If the workset input is null, the iteration has no work to process in the first step. This is an InvalidProgramException.

Source

Thrown at flink-core/src/main/java/org/apache/flink/api/common/operators/CollectionExecutor.java:414

        }

        previousAggregates.clear();
        aggregators.clear();

        return currentResult;
    }

    @SuppressWarnings("unchecked")
    private <T> List<T> executeDeltaIteration(DeltaIterationBase<?, ?> iteration, JobInfo jobInfo)
            throws Exception {
        Operator<?> solutionInput = iteration.getInitialSolutionSet();
        Operator<?> worksetInput = iteration.getInitialWorkset();
        if (solutionInput == null) {
            throw new InvalidProgramException(
                    "The delta iteration " + iteration.getName() + " has no initial solution set.");
        }
        if (worksetInput == null) {
            throw new InvalidProgramException(
                    "The delta iteration " + iteration.getName() + " has no initial workset.");
        }
        if (iteration.getSolutionSetDelta() == null) {
            throw new InvalidProgramException(
                    "The iteration "
                            + iteration.getName()
                            + " has no solution set delta defined (is not closed).");
        }
        if (iteration.getNextWorkset() == null) {
            throw new InvalidProgramException(
                    "The iteration "
                            + iteration.getName()
                            + " has no workset defined (is not closed).");
        }

        List<T> solutionInputData = (List<T>) execute(solutionInput, jobInfo);
        List<T> worksetInputData = (List<T>) execute(worksetInput, jobInfo);

View on GitHub (pinned to 2f3c205e92)

Solutions

  1. Ensure the initial workset DataSet is non-null before calling iterateDelta().
  2. Verify both the solution set and workset DataSets are properly sourced and non-null.
  3. Inspect the execution plan to confirm the workset input is wired.

Example fix

// before — workset is null
DataSet<Tuple2<Long,Long>> workset = null;
DeltaIteration<...> iter = solutionSet.iterateDelta(workset, 100, 0);
// after
DataSet<Tuple2<Long,Long>> workset = env.fromElements(Tuple2.of(1L, 1L));
DeltaIteration<...> iter = solutionSet.iterateDelta(workset, 100, 0);
Defensive patterns

Strategy: validation

Validate before calling

// Ensure initial workset is non-null
if (workset == null) {
    throw new IllegalStateException("Initial workset for delta iteration is null");
}
DeltaIteration<S,W> iter = solutionSet.iterateDelta(workset, 100, 0);

Prevention

When it happens

Trigger: A DeltaIterationBase has its solution set connected but its workset is null. In the high-level API this occurs when the workset argument to iterateDelta(solutionSet, maxIterations, keys) is null because the source producing it was not properly initialized.

Common situations: The workset DataSet variable is null because the preceding transformation or source read returned null or was skipped. This is the symmetric counterpart to error 371 for the second input.

Related errors


AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14). Data as JSON: /api/errors/2d9de972907cea40. Report an issue: GitHub.