apache/dolphinscheduler · error · TaskException

hiveCli task params is not valid

Error message

hiveCli task params is not valid

What it means

HiveCliTask.init() deserializes the task's params JSON into HiveCliParameters and calls checkParameters(). If required parameters are missing/blank (per HiveCliParameters.checkParameters, e.g. no SQL script for the chosen execution type), a TaskException('hiveCli task params is not valid') is thrown and the task fails before execution.

Source

Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-hivecli/src/main/java/org/apache/dolphinscheduler/plugin/task/hivecli/HiveCliTask.java:83

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

    @Override
    public List<String> getApplicationIds() throws TaskException {
        return Collections.emptyList();
    }

    @Override
    public void init() {
        log.info("hiveCli task params {}", taskRequest.getTaskParams());

        hiveCliParameters = JSONUtils.parseObject(taskRequest.getTaskParams(), HiveCliParameters.class);

        if (!hiveCliParameters.checkParameters()) {
            throw new TaskException("hiveCli task params is not valid");
        }
    }

    // todo split handle to submit and track
    @Override
    public void handle(TaskCallBack taskCallBack) throws TaskException {
        try {
            IShellInterceptorBuilder<?, ?> shellActuatorBuilder = ShellInterceptorBuilderFactory.newBuilder()
                    .appendScript(buildCommand());
            final TaskResponse taskResponse = shellCommandExecutor.run(shellActuatorBuilder, taskCallBack);
            setExitStatusCode(taskResponse.getExitStatusCode());
            setAppIds(taskResponse.getAppIds());
            setProcessId(taskResponse.getProcessId());
            setTaskOutputParams(shellCommandExecutor.getTaskOutputParams());
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            log.error("The current HiveCLI Task has been interrupted", e);
            setExitStatusCode(EXIT_CODE_FAILURE);

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Open the HiveCLI task definition and fill in the required field: a non-empty hiveSqlScript (for SQL type) or exactly one .sql resource (for FILE type).
  2. Verify the execution type selected matches what you provided (SQL script vs FILE resource).
  3. Check that any workflow/parameter placeholders inside the SQL are not evaluating to empty at save/run time.
  4. If upgrading DolphinScheduler, re-open and re-save the task definition so params are serialized in the current HiveCliParameters schema.

Example fix

// before (task params json)
{"hiveCliTaskExecutionType":"SQL","hiveSqlScript":""}
// after
{"hiveCliTaskExecutionType":"SQL","hiveSqlScript":"SELECT * FROM my_table;"}
Defensive patterns

Strategy: validation

Validate before calling

// Caller-side check before the task runs
HiveCliParameters p = JSONUtils.parseObject(taskParamsJson, HiveCliParameters.class);
if (p == null || !p.checkParameters()) {
    throw new IllegalArgumentException(
        "Provide a non-empty hiveSqlScript (SQL type) or one sql resource (FILE type)");
}

Try / catch

try {
    task.init();
} catch (TaskException e) {
    if ("hiveCli task params is not valid".equals(e.getMessage())) {
        // surface which params are missing in the UI / fix the task definition
    }
}

Prevention

When it happens

Trigger: Defining a HiveCLI task whose params JSON lacks the fields required by HiveCliParameters.checkParameters() — typically an empty hiveSqlScript when execution type is not TYPE_FILE, or an empty/absent resource list when type is 'FILE' — or params that deserialize to null fields.

Common situations: User saved the task definition without entering SQL; the 'FILE' execution type selected but no resource uploaded; workflow parameter substitution replaced the SQL with an empty string; a migration/version upgrade changed the params schema so old definitions no longer pass checkParameters.

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


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