{"record":{"id":"c68a2ba62557e7df","repo":"apache/dolphinscheduler","slug":"flink-task-params-is-not-valid-c68a2b","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/src/main/java/org/apache/dolphinscheduler/plugin/task/flink/FlinkTask.java","lineNumber":62,"sourceCode":"\n    /**\n     * rules for flink application ID\n     */\n    protected static final Pattern FLINK_APPLICATION_REGEX = Pattern.compile(TaskConstants.FLINK_APPLICATION_REGEX);\n\n    public FlinkTask(TaskExecutionContext taskExecutionContext) {\n        super(taskExecutionContext);\n        this.taskExecutionContext = taskExecutionContext;\n    }\n\n    @Override\n    public void init() {\n\n        flinkParameters = JSONUtils.parseObject(taskExecutionContext.getTaskParams(), FlinkParameters.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    /**\n     * create command\n     *\n     * @return command\n     */\n    @Override\n    protected String getScript() {\n        return buildScriptWithParameterReplacement(flinkParameters);\n    }\n\n    /**\n     * Apply parameter replacement to initScript/rawScript, generate script files and build run command.\n     *\n     * @param params flink parameters\n     * @return run command string","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-task-plugin/dolphinscheduler-task-flink/src/main/java/org/apache/dolphinscheduler/plugin/task/flink/FlinkTask.java#L44-L80","documentation":"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.","triggerScenarios":"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.","commonSituations":"Flink task created without a main jar/main class; JSON params corrupted by failed parameter substitution; older task definitions incompatible with current FlinkParameters schema.","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"],"exampleFix":"// before\n{\"programType\":\"SQL\"}\n// after\n{\"programType\":\"SQL\",\"deployMode\":\"local\",\"sql\":\"select 1\",\"resourceList\":[]}","handlingStrategy":"validation","validationCode":"FlinkParameters params = JSONUtils.parseObject(taskParams, FlinkParameters.class);\nif (params == null || !params.checkParameters()) {\n    throw new IllegalArgumentException(\"taskParams must deserialize to FlinkParameters and pass checkParameters()\");\n}","typeGuard":"boolean isValidFlinkParams(String json) {\n    FlinkParameters p = JSONUtils.parseObject(json, FlinkParameters.class);\n    return p != null && p.checkParameters();\n}","tryCatchPattern":"try {\n    task.init();\n} catch (RuntimeException e) {\n    log.error(\"invalid flink params: {}\", taskExecutionContext.getTaskParams(), e);\n    // fail fast; fix task definition\n}","preventionTips":["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"],"tags":["flink","task-params","validation","batch"],"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-14T05:17:10.506Z"}