apache/dolphinscheduler · error · TaskException
shell task params is not valid
Error message
shell task params is not valid
What it means
ShellTask.init() parses the task's JSON params into ShellParameters via JSONUtils and validates them. If parsing yields null or ShellParameters.checkParameters() returns false, a TaskException is thrown with this message. checkParameters() fails when the shell script body is empty/absent, so the task has nothing to execute.
Source
Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-shell/src/main/java/org/apache/dolphinscheduler/plugin/task/shell/ShellTask.java:56
private ShellParameters shellParameters;
private final ShellCommandExecutor shellCommandExecutor;
public ShellTask(TaskExecutionContext taskExecutionContext) {
super(taskExecutionContext);
this.shellCommandExecutor = new ShellCommandExecutor(taskExecutionContext);
}
@Override
public void init() {
shellParameters = JSONUtils.parseObject(taskRequest.getTaskParams(), ShellParameters.class);
log.info("Initialize shell task params {}", JSONUtils.toPrettyJsonString(shellParameters));
if (shellParameters == null || !shellParameters.checkParameters()) {
throw new TaskException("shell task params is not valid");
}
}
@SuppressWarnings("unchecked")
@Override
public void handle(TaskCallBack taskCallBack) throws TaskException {
try {
IShellInterceptorBuilder<?, ?> shellActuatorBuilder = ShellInterceptorBuilderFactory.newBuilder()
.properties(ParameterUtils.convert(taskRequest.getPrepareParamsMap()))
.appendScript(shellParameters.getRawScript());
TaskResponse commandExecuteResult = shellCommandExecutor.run(shellActuatorBuilder, taskCallBack);
setExitStatusCode(commandExecuteResult.getExitStatusCode());
setProcessId(commandExecuteResult.getProcessId());
shellParameters.dealOutParam(shellCommandExecutor.getTaskOutputParams());
taskRequest.setVarPool(shellParameters.getVarPool());
} catch (InterruptedException e) {
Thread.currentThread().interrupt();View on GitHub (pinned to 02eac45a1b)
Solutions
- Open the task definition and enter the shell script in the Script field (rawScript must be non-empty)
- Validate the task params JSON before submitting: JSONUtils.parseObject(params, ShellParameters.class) != null and checkParameters() == true
- If submitting via API/Python SDK, confirm the taskParams object includes the script content and that it is serialized once, not double-encoded
Example fix
// before (API request with empty script)
{"taskType":"SHELL","taskParams":{"localParams":[]}}
// after
{"taskType":"SHELL","taskParams":{"rawScript":"echo hello","localParams":[]}} Defensive patterns
Strategy: validation
Validate before calling
ShellParameters p = JSONUtils.parseObject(taskRequest.getTaskParams(), ShellParameters.class);
if (p == null || !p.checkParameters()) {
throw new IllegalArgumentException("shell task params missing or script empty");
} Type guard
boolean isValidShellParams(String json) {
ShellParameters p = JSONUtils.parseObject(json, ShellParameters.class);
return p != null && p.checkParameters();
} Prevention
- Never save a SHELL task node with an empty script editor
- Assert params JSON serializes and checkParameters() passes in workflow CI tests before submitting via API
- Avoid double-encoding task params JSON in SDK/API calls
When it happens
Trigger: TaskExecutionContext.getTaskParams() is null/blank, is not valid JSON, or deserializes to a ShellParameters whose localParams/rawScript field is empty so checkParameters() returns false.
Common situations: Workflow saved with an empty script editor box; upstream automation posted a task-def JSON missing the script field; params corrupted by double-encoding the JSON when calling the API.
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
- dvc task params is not valid
- EMR Serverless task params are not valid
- emr task params is not valid
- flink task params is not valid
- flink task params is not valid
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/445df6490600a167.
Report an issue: GitHub.