apache/flink · error · RuntimeException
Execution config has not been set properly for this plan
Error message
Execution config has not been set properly for this plan
What it means
Thrown by Plan.getExecutionConfig() when the executionConfig field is null. A Plan is the data-flow description submitted to the optimizer; it must have its ExecutionConfig attached during program assembly (typically by the ExecutionEnvironment). If getExecutionConfig() is reached before the environment wired it in, the plan is incomplete and execution would otherwise NPE deeper in the optimizer.
Source
Thrown at flink-core/src/main/java/org/apache/flink/api/common/Plan.java:303
/**
* Gets the optimizer post-pass class for this job. The post-pass typically creates utility
* classes for data types and is specific to a particular data model (record, tuple, Scala, ...)
*
* @return The name of the class implementing the optimizer post-pass.
*/
public String getPostPassClassName() {
return "org.apache.flink.optimizer.postpass.JavaApiPostPass";
}
/**
* Gets the execution config object.
*
* @return The execution config object.
*/
public ExecutionConfig getExecutionConfig() {
if (executionConfig == null) {
throw new RuntimeException("Execution config has not been set properly for this plan");
}
return executionConfig;
}
/**
* Sets the runtime config object defining execution parameters.
*
* @param executionConfig The execution config to use.
*/
public void setExecutionConfig(ExecutionConfig executionConfig) {
this.executionConfig = executionConfig;
}
// ------------------------------------------------------------------------
/**
* Traverses the job depth first from all data sinks on towards the sources.
*View on GitHub (pinned to 2f3c205e92)
Solutions
- Always set the ExecutionConfig on a manually constructed Plan: plan.setExecutionConfig(new ExecutionConfig()).
- Use ExecutionEnvironment.getPlan() / createProgramPlan() helpers which attach the config automatically.
- If loading a plan from a jar, ensure the entry-point environment initialized the config before plan extraction.
Example fix
// before Plan plan = new Plan(operator, "job"); plan.getExecutionConfig(); // after Plan plan = new Plan(operator, "job"); plan.setExecutionConfig(new ExecutionConfig()); plan.getExecutionConfig();
Defensive patterns
Strategy: validation
Validate before calling
if (plan.getExecutionConfig() == null) { // guard against the throw
plan.setExecutionConfig(new ExecutionConfig());
}
// safer: always set explicitly
plan.setExecutionConfig(new ExecutionConfig()); Try / catch
try { plan.getExecutionConfig(); }
catch (RuntimeException e) { plan.setExecutionConfig(new ExecutionConfig()); } Prevention
- Always call setExecutionConfig on manually built Plans.
- Prefer ExecutionEnvironment helpers that attach the config automatically.
- In tests, build Plans through an ExecutionEnvironment.
When it happens
Trigger: Calling plan.getExecutionConfig() on a Plan constructed directly (new Plan(...)) without invoking setExecutionConfig(...); deserializing a Plan from a serialized program where the config wasn't serialized; optimizer tests that build a Plan by hand.
Common situations: Unit tests constructing a Plan without an environment; custom client code that loads a saved plan; edge cases in the optimizer pipeline where the plan reaches post-pass before config attachment.
Related errors
- The collection contains a null element
- The collection contains a null element
- Hadoop input split must not be null
- Hadoop JobConf must not be null when input split is configur
- Reducer may not be null.
AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14).
Data as JSON: /api/errors/653c5a38051cab37.
Report an issue: GitHub.