apache/dolphinscheduler · error · TaskException

Execute procedure task failed

Error message

Execute procedure task failed

What it means

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.

Source

Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/src/main/java/org/apache/dolphinscheduler/plugin/task/procedure/ProcedureTask.java:139

                stat.execute();

                Map<String, String> sqlOutParameters = parseOutParameters(stat, sqlOutPlaceHolders);

                // todo: If the task is failed, do we need to deal with the output parameters? otherwise the localparam
                // cannot pass to post.
                // If so, we can set the output parameters in the finally block.
                procedureParameters.dealOutParam(sqlOutParameters);
                taskExecutionContext.setVarPool(procedureParameters.getVarPool());
                setExitStatusCode(EXIT_CODE_SUCCESS);
            }
        } catch (Exception e) {
            if (exitStatusCode == TaskConstants.EXIT_CODE_KILL) {
                log.info("This procedure task has been killed");
                return;
            }
            setExitStatusCode(EXIT_CODE_FAILURE);
            log.error("Failed to execute this procedure task", e);
            throw new TaskException("Execute procedure task failed", e);
        }
    }

    @Override
    public void cancel() throws TaskException {
        if (sessionStatement != null) {
            try {
                log.info("Try to cancel this procedure task");
                sessionStatement.cancel();
                setExitStatusCode(TaskConstants.EXIT_CODE_KILL);
                log.info("This procedure task was canceled");
            } catch (Exception ex) {
                log.warn("Failed to cancel this procedure task", ex);
                throw new TaskException("Cancel this procedure task failed", ex);
            }
        } else {
            log.info(
                    "Attempted to cancel this procedure task, but no active statement exists. Possible reasons: task not started, already completed, or canceled.");

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Inspect the caused-by SQLException for the database's own error message
  2. Verify the datasource connection info and that the procedure exists with the expected signature
  3. Check IN/OUT parameter mappings and types in the task definition
  4. Fix errors raised inside the procedure body and re-run
Defensive patterns

Strategy: try-catch

When it happens

Trigger: 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.

Common situations: See trigger scenarios.


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