{"record":{"id":"4af081c8dfde3dec","repo":"apache/dolphinscheduler","slug":"flink-task-params-is-not-valid","errorCode":null,"errorMessage":"flink task params is not valid","messagePattern":"flink task params is not valid","errorType":"validation","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-task-plugin/dolphinscheduler-task-flink-stream/src/main/java/org/apache/dolphinscheduler/plugin/task/flink/FlinkStreamTask.java","lineNumber":53,"sourceCode":"public class FlinkStreamTask extends FlinkTask implements StreamTask {\n\n    private FlinkStreamParameters flinkParameters;\n\n    private final TaskExecutionContext taskExecutionContext;\n\n    public FlinkStreamTask(TaskExecutionContext taskExecutionContext) {\n        super(taskExecutionContext);\n        this.taskExecutionContext = taskExecutionContext;\n    }\n\n    @Override\n    public void init() {\n\n        flinkParameters = JSONUtils.parseObject(taskExecutionContext.getTaskParams(), FlinkStreamParameters.class);\n        log.info(\"Initialize Flink task params {}\", JSONUtils.toPrettyJsonString(flinkParameters));\n\n        if (flinkParameters == null || !flinkParameters.checkParameters()) {\n            throw new RuntimeException(\"flink task params is not valid\");\n        }\n    }\n\n    @Override\n    protected String getScript() {\n        return buildScriptWithParameterReplacement(flinkParameters);\n    }\n\n    @Override\n    public AbstractParameters getParameters() {\n        return flinkParameters;\n    }\n\n    @Override\n    public void cancelApplication() throws TaskException {\n        List<String> appIds = getApplicationIds();\n        if (CollectionUtils.isEmpty(appIds)) {\n            log.error(\"can not get appId, taskInstanceId:{}\", taskExecutionContext.getTaskInstanceId());","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-task-plugin/dolphinscheduler-task-flink-stream/src/main/java/org/apache/dolphinscheduler/plugin/task/flink/FlinkStreamTask.java#L35-L71","documentation":"FlinkStreamTask.init() deserializes the taskParams JSON into FlinkStreamParameters and validates them via checkParameters(). If the JSON cannot be parsed or required fields (e.g. main jar / program type) are missing, it throws RuntimeException('flink task params is not valid'). It guards against executing a Flink streaming job with an unusable configuration.","triggerScenarios":"taskExecutionContext.getTaskParams() is null, malformed JSON, or deserializes to a FlinkStreamParameters whose checkParameters() returns false (missing mainJar/mainClass/programType depending on flink task type).","commonSituations":"Task JSON hand-edited or generated by older UI versions missing required fields; parameter references not resolved leaving nulls; upgrading DolphinScheduler where parameter schema changed.","solutions":["Inspect the taskParams JSON of the failing task instance and confirm it parses as FlinkStreamParameters","Fill in required fields (mainJar resource, mainClass, programType) in the Flink task form and save","Re-run the task after re-saving so taskParams are regenerated","If caused by an upgrade, re-create or migrate the task definition to the current schema"],"exampleFix":"// before\n{\"localParams\":[],\"resourceList\":[]}\n// after\n{\"mainClass\":\"com.example.Main\",\"programType\":\"SQL\",\"resourceList\":[{\"resourceName\":\"job.jar\"}],\"localParams\":[]}","handlingStrategy":"validation","validationCode":"FlinkStreamParameters params = JSONUtils.parseObject(taskParams, FlinkStreamParameters.class);\nif (params == null || !params.checkParameters()) {\n    throw new IllegalArgumentException(\"taskParams must deserialize to FlinkStreamParameters and pass checkParameters()\");\n}","typeGuard":"boolean isValidParams(String json) {\n    FlinkStreamParameters p = JSONUtils.parseObject(json, FlinkStreamParameters.class);\n    return p != null && p.checkParameters();\n}","tryCatchPattern":"try {\n    task.init();\n} catch (RuntimeException e) {\n    log.error(\"Flink task params invalid: {}\", taskExecutionContext.getTaskParams(), e);\n    // mark task failed, do not retry blindly\n}","preventionTips":["Always configure mainJar/mainClass/programType in the Flink task form","Validate taskParams JSON after upgrades or migrations","Re-save tasks via UI rather than editing params JSON by hand","Add a pre-flight check that parses params before task submission"],"tags":["flink","task-params","validation","dolphinscheduler"],"backgroundTag":"missing-required-config-field","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}