apache/dolphinscheduler · error · TaskException
Execute task failed
Error message
Execute task failed
What it means
AbstractYarnTask.handle wraps any non-interrupt exception from task execution into TaskException('Execute task failed'). This is the generic failure path for errors preparing/running the Yarn job (command build errors, process start failures, non-zero exits).
Source
Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractYarnTask.java:66
IShellInterceptorBuilder shellActuatorBuilder = ShellInterceptorBuilderFactory.newBuilder()
.properties(ParameterUtils.convert(taskRequest.getPrepareParamsMap()))
// todo: do we need to move the replace to subclass?
.appendScript(getScript().replaceAll("\\r\\n", System.lineSeparator()));
// SHELL task exit code
TaskResponse response = shellCommandExecutor.run(shellActuatorBuilder, taskCallBack);
setExitStatusCode(response.getExitStatusCode());
// set appIds
setAppIds(String.join(TaskConstants.COMMA, getApplicationIds()));
setProcessId(response.getProcessId());
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
log.info("The current yarn task has been interrupted", ex);
setExitStatusCode(TaskConstants.EXIT_CODE_FAILURE);
throw new TaskException("The current yarn task has been interrupted", ex);
} catch (Exception e) {
log.error("yarn process failure", e);
exitStatusCode = -1;
throw new TaskException("Execute task failed", e);
}
}
// todo
@Override
public void submitApplication() throws TaskException {
}
// todo
@Override
public void trackApplicationStatus() throws TaskException {
}
/**
* cancel application
*View on GitHub (pinned to 02eac45a1b)
Solutions
- Inspect the wrapped cause 'yarn process failure' log for the real exception
- Verify Hadoop/YARN client setup on the worker (HADOOP_HOME, configs, executables)
- Validate the task parameters produce a correct command
- Check worker disk/memory and process-spawn limits
- Re-run the task after fixing; note exitStatusCode is set to -1
Defensive patterns
Strategy: try-catch
Validate before calling
// pre-flight checks before handle() assert hadoopHome != null && new File(hadoopHome).exists(); assert taskParamsValidated; // AbstractParameters.checkCpus etc.
Try / catch
try {
yarnTask.handle(taskCallBack);
} catch (TaskException e) {
log.error("Yarn task failed: {}", e.getCause() == null ? e : e.getCause().getMessage(), e);
// inspect the wrapped cause — 'Execute task failed' is always generic
} Prevention
- Always inspect the wrapped cause; the message itself is generic
- Validate task parameters before submission
- Verify HADOOP_HOME and YARN client configs on workers
- Check worker resources (disk, memory, ulimits) for spawn failures
When it happens
Trigger: Any Exception other than InterruptedException thrown in handle — shellCommandExecutor.run(...) fails, command generation fails, process cannot start, or underlying API/IO errors.
Common situations: Invalid task parameters producing a bad command; Hadoop client misconfiguration (HADOOP_HOME, yarn-site.xml); worker cannot spawn the process or lacks binaries; exceptions in submitApplication/checkApplication.
Related errors
- Cannot find the logic task factory: ${taskType}
- The default branch is empty, please check the switch task co
- The current yarn task has been interrupted
- cancel application error
- Failed to get Kubernetes application status
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/40059002b9f23f3b.
Report an issue: GitHub.