apache/dolphinscheduler · error · RuntimeException

chunjun task params is not valid

Error message

chunjun task params is not valid

What it means

ChunJunTask.init() parses taskParams JSON into ChunJunParameters and calls checkParameters(); when validation fails it throws RuntimeException 'chunjun task params is not valid'. This means the JSON parsed but required ChunJun parameters (e.g. deployMode, others, and job/script inputs) are absent or inconsistent.

Source

Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-chunjun/src/main/java/org/apache/dolphinscheduler/plugin/task/chunjun/ChunJunTask.java:78

    private ChunJunParameters chunJunParameters;

    private final ShellCommandExecutor shellCommandExecutor;

    public ChunJunTask(TaskExecutionContext taskExecutionContext) {
        super(taskExecutionContext);
        this.shellCommandExecutor = new ShellCommandExecutor(taskExecutionContext);
    }

    /**
     * init chunjun config
     */
    @Override
    public void init() {
        chunJunParameters = JSONUtils.parseObject(taskRequest.getTaskParams(), ChunJunParameters.class);
        log.info("Initialize chunjun task params {}", JSONUtils.toPrettyJsonString(taskRequest.getTaskParams()));

        if (!chunJunParameters.checkParameters()) {
            throw new RuntimeException("chunjun task params is not valid");
        }
    }

    @SuppressWarnings("unchecked")
    @Override
    public void handle(TaskCallBack taskCallBack) throws TaskException {
        try {
            Map<String, Property> paramsMap = taskRequest.getPrepareParamsMap();

            IShellInterceptorBuilder<?, ?> shellActuatorBuilder = ShellInterceptorBuilderFactory.newBuilder()
                    .properties(ParameterUtils.convert(paramsMap))
                    .appendScript(buildCommand(buildChunJunJsonFile(paramsMap)));
            TaskResponse commandExecuteResult = shellCommandExecutor.run(shellActuatorBuilder, taskCallBack);

            setExitStatusCode(commandExecuteResult.getExitStatusCode());

            // todo get applicationId
            setAppIds(String.join(TaskConstants.COMMA, Collections.emptySet()));

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Open the task definition and fill in all required ChunJun parameter fields (job/script content, deploy mode, etc.).
  2. Validate the taskParams JSON against ChunJunParameters fields (JSONUtils round-trip) before submitting.
  3. Inspect ChunJunParameters.checkParameters() to see exactly which flags must be true.
  4. If using the API, mirror a working task's JSON structure rather than hand-crafting it.
  5. Ensure the plugin version's parameter schema matches the workflow definition.

Example fix

// before
taskParams = {
  "deployMode": "local"
  // no job content
}
// after
taskParams = {
  "deployMode": "local",
  "json": "{\"job\":{\"content\":[...],\"setting\":{...}}}"
}
Defensive patterns

Strategy: validation

Validate before calling

ChunJunParameters p = JSONUtils.parseObject(taskParams, ChunJunParameters.class);
if (p == null || !p.checkParameters()) {
    throw new IllegalArgumentException("chunjun taskParams missing required fields");
}

Type guard

boolean isValidChunjunParams(String json) {
    ChunJunParameters p = JSONUtils.parseObject(json, ChunJunParameters.class);
    return p != null && p.checkParameters();
}

Try / catch

try {
    task.init();
} catch (RuntimeException e) {
    log.error("invalid chunjun params: {}", taskParams, e);
    throw e;
}

Prevention

When it happens

Trigger: Creating a ChunJun task whose taskParams JSON is missing required fields checked by ChunJunParameters.checkParameters() — for instance neither 'job' nor 'json' script content is provided, or required plugin configuration fields are blank.

Common situations: Users pasting a ChunJun Flink SQL/json job into the wrong parameter field; leaving the job content empty; workflow saved via API with hand-written taskParams JSON missing keys; UI/plugin version mismatch dropping new required fields.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06). Data as JSON: /api/errors/3f0e22db1c80b322. Report an issue: GitHub.