apache/dolphinscheduler · error · TaskException

python task params is not valid

Error message

python task params is not valid

What it means

A parameter validation guard in PythonTask.init: pythonParameters is null after parsing taskParams (invalid JSON) or checkParameters() failed because the raw python script is empty/missing. The offending input is the taskParams JSON in the task definition; the task aborts at init before the python command is built.

Source

Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonTask.java:69

    private final ShellCommandExecutor shellCommandExecutor;

    protected static final String PYTHON_LAUNCHER = "PYTHON_LAUNCHER";

    public PythonTask(TaskExecutionContext taskRequest) {
        super(taskRequest);

        this.shellCommandExecutor = new ShellCommandExecutor(taskRequest);
    }

    @Override
    public void init() {

        pythonParameters = JSONUtils.parseObject(taskRequest.getTaskParams(), PythonParameters.class);

        log.info("Initialize python task params {}", JSONUtils.toPrettyJsonString(pythonParameters));
        if (pythonParameters == null || !pythonParameters.checkParameters()) {
            throw new TaskException("python task params is not valid");
        }
    }

    @SuppressWarnings("unchecked")
    @Override
    public void handle(TaskCallBack taskCallBack) throws TaskException {
        try {
            // generate the content of this python script
            String pythonScriptContent = buildPythonScriptContent();
            // generate the file path of this python script
            String pythonScriptFile = buildPythonCommandFilePath();

            // create this file
            createPythonCommandFileIfNotExists(pythonScriptContent, pythonScriptFile);

            IShellInterceptorBuilder<?, ?> shellActuatorBuilder = ShellInterceptorBuilderFactory.newBuilder()
                    .appendScript(buildPythonExecuteCommand(pythonScriptFile));

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Provide a non-empty python script in the task definition
  2. Ensure taskParams JSON deserializes into PythonParameters (correct field names)
  3. Validate on save in the UI to catch empty scripts early
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonTask.java:69 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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