{"record":{"id":"79d9ebd4163308a5","repo":"apache/dolphinscheduler","slug":"execute-procedure-task-failed","errorCode":null,"errorMessage":"Execute procedure task failed","messagePattern":"Execute procedure task failed","errorType":"exception","errorClass":"TaskException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/src/main/java/org/apache/dolphinscheduler/plugin/task/procedure/ProcedureTask.java","lineNumber":139,"sourceCode":"                stat.execute();\n\n                Map<String, String> sqlOutParameters = parseOutParameters(stat, sqlOutPlaceHolders);\n\n                // todo: If the task is failed, do we need to deal with the output parameters? otherwise the localparam\n                // cannot pass to post.\n                // If so, we can set the output parameters in the finally block.\n                procedureParameters.dealOutParam(sqlOutParameters);\n                taskExecutionContext.setVarPool(procedureParameters.getVarPool());\n                setExitStatusCode(EXIT_CODE_SUCCESS);\n            }\n        } catch (Exception e) {\n            if (exitStatusCode == TaskConstants.EXIT_CODE_KILL) {\n                log.info(\"This procedure task has been killed\");\n                return;\n            }\n            setExitStatusCode(EXIT_CODE_FAILURE);\n            log.error(\"Failed to execute this procedure task\", e);\n            throw new TaskException(\"Execute procedure task failed\", e);\n        }\n    }\n\n    @Override\n    public void cancel() throws TaskException {\n        if (sessionStatement != null) {\n            try {\n                log.info(\"Try to cancel this procedure task\");\n                sessionStatement.cancel();\n                setExitStatusCode(TaskConstants.EXIT_CODE_KILL);\n                log.info(\"This procedure task was canceled\");\n            } catch (Exception ex) {\n                log.warn(\"Failed to cancel this procedure task\", ex);\n                throw new TaskException(\"Cancel this procedure task failed\", ex);\n            }\n        } else {\n            log.info(\n                    \"Attempted to cancel this procedure task, but no active statement exists. Possible reasons: task not started, already completed, or canceled.\");","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/src/main/java/org/apache/dolphinscheduler/plugin/task/procedure/ProcedureTask.java#L121-L157","documentation":"A catch-all in ProcedureTask.handle: executing the stored procedure via JDBC CallableStatement threw — datasource unreachable, wrong procedure name/signature, IN/OUT parameter type mismatch, or a database error raised inside the procedure itself. The exit code is set to failure and the JDBC exception is preserved as the cause; output parameters from a partially-run procedure are discarded.","triggerScenarios":"Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/src/main/java/org/apache/dolphinscheduler/plugin/task/procedure/ProcedureTask.java:139 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the caused-by SQLException for the database's own error message","Verify the datasource connection info and that the procedure exists with the expected signature","Check IN/OUT parameter mappings and types in the task definition","Fix errors raised inside the procedure body and re-run"],"exampleFix":null,"handlingStrategy":"try-catch","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"}