{"record":{"id":"40059002b9f23f3b","repo":"apache/dolphinscheduler","slug":"execute-task-failed","errorCode":null,"errorMessage":"Execute task failed","messagePattern":"Execute task failed","errorType":"exception","errorClass":"TaskException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractYarnTask.java","lineNumber":66,"sourceCode":"            IShellInterceptorBuilder shellActuatorBuilder = ShellInterceptorBuilderFactory.newBuilder()\n                    .properties(ParameterUtils.convert(taskRequest.getPrepareParamsMap()))\n                    // todo: do we need to move the replace to subclass?\n                    .appendScript(getScript().replaceAll(\"\\\\r\\\\n\", System.lineSeparator()));\n            // SHELL task exit code\n            TaskResponse response = shellCommandExecutor.run(shellActuatorBuilder, taskCallBack);\n            setExitStatusCode(response.getExitStatusCode());\n            // set appIds\n            setAppIds(String.join(TaskConstants.COMMA, getApplicationIds()));\n            setProcessId(response.getProcessId());\n        } catch (InterruptedException ex) {\n            Thread.currentThread().interrupt();\n            log.info(\"The current yarn task has been interrupted\", ex);\n            setExitStatusCode(TaskConstants.EXIT_CODE_FAILURE);\n            throw new TaskException(\"The current yarn task has been interrupted\", ex);\n        } catch (Exception e) {\n            log.error(\"yarn process failure\", e);\n            exitStatusCode = -1;\n            throw new TaskException(\"Execute task failed\", e);\n        }\n    }\n\n    // todo\n    @Override\n    public void submitApplication() throws TaskException {\n\n    }\n\n    // todo\n    @Override\n    public void trackApplicationStatus() throws TaskException {\n\n    }\n\n    /**\n     * cancel application\n     *","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractYarnTask.java#L48-L84","documentation":"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).","triggerScenarios":"Any Exception other than InterruptedException thrown in handle — shellCommandExecutor.run(...) fails, command generation fails, process cannot start, or underlying API/IO errors.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// pre-flight checks before handle()\nassert hadoopHome != null && new File(hadoopHome).exists();\nassert taskParamsValidated; // AbstractParameters.checkCpus etc.","typeGuard":null,"tryCatchPattern":"try {\n    yarnTask.handle(taskCallBack);\n} catch (TaskException e) {\n    log.error(\"Yarn task failed: {}\", e.getCause() == null ? e : e.getCause().getMessage(), e);\n    // inspect the wrapped cause — 'Execute task failed' is always generic\n}","preventionTips":["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"],"tags":["yarn","task-execution","generic-error"],"backgroundTag":"command-execution-failed","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"}