{"record":{"id":"2faa0a3416f21967","repo":"apache/dolphinscheduler","slug":"python-task-params-is-not-valid","errorCode":null,"errorMessage":"python task params is not valid","messagePattern":"python task params is not valid","errorType":"validation","errorClass":"TaskException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonTask.java","lineNumber":69,"sourceCode":"\n    private final ShellCommandExecutor shellCommandExecutor;\n\n    protected static final String PYTHON_LAUNCHER = \"PYTHON_LAUNCHER\";\n\n    public PythonTask(TaskExecutionContext taskRequest) {\n        super(taskRequest);\n\n        this.shellCommandExecutor = new ShellCommandExecutor(taskRequest);\n    }\n\n    @Override\n    public void init() {\n\n        pythonParameters = JSONUtils.parseObject(taskRequest.getTaskParams(), PythonParameters.class);\n\n        log.info(\"Initialize python task params {}\", JSONUtils.toPrettyJsonString(pythonParameters));\n        if (pythonParameters == null || !pythonParameters.checkParameters()) {\n            throw new TaskException(\"python task params is not valid\");\n        }\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public void handle(TaskCallBack taskCallBack) throws TaskException {\n        try {\n            // generate the content of this python script\n            String pythonScriptContent = buildPythonScriptContent();\n            // generate the file path of this python script\n            String pythonScriptFile = buildPythonCommandFilePath();\n\n            // create this file\n            createPythonCommandFileIfNotExists(pythonScriptContent, pythonScriptFile);\n\n            IShellInterceptorBuilder<?, ?> shellActuatorBuilder = ShellInterceptorBuilderFactory.newBuilder()\n                    .appendScript(buildPythonExecuteCommand(pythonScriptFile));\n","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonTask.java#L51-L87","documentation":"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.","triggerScenarios":"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.","commonSituations":"See trigger scenarios.","solutions":["Provide a non-empty python script in the task definition","Ensure taskParams JSON deserializes into PythonParameters (correct field names)","Validate on save in the UI to catch empty scripts early"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}