apache/dolphinscheduler · error · RuntimeException
flink task params is not valid
Error message
flink task params is not valid
What it means
FlinkTask.init() (batch Flink plugin) parses taskParams into FlinkParameters and validates with checkParameters(). If parsing fails or required fields are absent, it throws RuntimeException('flink task params is not valid'). It stops batch Flink jobs from running with incomplete configuration.
Source
Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-flink/src/main/java/org/apache/dolphinscheduler/plugin/task/flink/FlinkTask.java:62
/**
* rules for flink application ID
*/
protected static final Pattern FLINK_APPLICATION_REGEX = Pattern.compile(TaskConstants.FLINK_APPLICATION_REGEX);
public FlinkTask(TaskExecutionContext taskExecutionContext) {
super(taskExecutionContext);
this.taskExecutionContext = taskExecutionContext;
}
@Override
public void init() {
flinkParameters = JSONUtils.parseObject(taskExecutionContext.getTaskParams(), FlinkParameters.class);
log.info("Initialize flink task params {}", JSONUtils.toPrettyJsonString(flinkParameters));
if (flinkParameters == null || !flinkParameters.checkParameters()) {
throw new RuntimeException("flink task params is not valid");
}
}
/**
* create command
*
* @return command
*/
@Override
protected String getScript() {
return buildScriptWithParameterReplacement(flinkParameters);
}
/**
* Apply parameter replacement to initScript/rawScript, generate script files and build run command.
*
* @param params flink parameters
* @return run command stringView on GitHub (pinned to 02eac45a1b)
Solutions
- Open the task definition and verify required Flink parameters (mainJar, mainClass, programType, deployMode) are set
- Validate the taskParams JSON parses as FlinkParameters (JSONUtils.parseObject not returning null)
- Re-save the task to regenerate params and retry
- If migrating from an older version, update the task definition to the current schema
Example fix
// before
{"programType":"SQL"}
// after
{"programType":"SQL","deployMode":"local","sql":"select 1","resourceList":[]} Defensive patterns
Strategy: validation
Validate before calling
FlinkParameters params = JSONUtils.parseObject(taskParams, FlinkParameters.class);
if (params == null || !params.checkParameters()) {
throw new IllegalArgumentException("taskParams must deserialize to FlinkParameters and pass checkParameters()");
} Type guard
boolean isValidFlinkParams(String json) {
FlinkParameters p = JSONUtils.parseObject(json, FlinkParameters.class);
return p != null && p.checkParameters();
} Try / catch
try {
task.init();
} catch (RuntimeException e) {
log.error("invalid flink params: {}", taskExecutionContext.getTaskParams(), e);
// fail fast; fix task definition
} Prevention
- Fill all required fields (mainJar, mainClass, programType, deployMode) in the Flink task UI
- Validate params JSON when migrating tasks between DS versions
- Avoid hand-editing the params JSON in the database
- Run a dry-run/preview to confirm task params serialize correctly
When it happens
Trigger: taskParams JSON is null/malformed, or FlinkParameters.checkParameters() returns false, e.g. missing mainClass for a jar run or empty deployMode/programType combinations that the check rejects.
Common situations: Flink task created without a main jar/main class; JSON params corrupted by failed parameter substitution; older task definitions incompatible with current FlinkParameters schema.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- flink task params is not valid
- dvc task params is not valid
- EMR Serverless task params are not valid
- emr task params is not valid
- gRPC task params is not valid, method definition may not cor
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/c68a2ba62557e7df.
Report an issue: GitHub.