{"record":{"id":"b2e7f46bf371004d","repo":"apache/dolphinscheduler","slug":"execute-emr-task-failed-b2e7f4","errorCode":null,"errorMessage":"Execute emr task failed","messagePattern":"Execute emr task failed","errorType":"exception","errorClass":"TaskException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-task-plugin/dolphinscheduler-task-emr/src/main/java/org/apache/dolphinscheduler/plugin/task/emr/EmrJobFlowTask.java","lineNumber":108,"sourceCode":"            log.info(\"emr task finished with cluster status : {}\", clusterStatus);\n        }\n    }\n\n    @Override\n    public void trackApplicationStatus() throws TaskException {\n        ClusterStatus clusterStatus = null;\n        try {\n            clusterStatus = getClusterStatus();\n\n            while (waitingStateSet.contains(clusterStatus.getState())) {\n                TimeUnit.SECONDS.sleep(10);\n                clusterStatus = getClusterStatus();\n            }\n        } catch (EmrTaskException | SdkBaseException e) {\n            log.error(\"emr task failed with error\", e);\n        } catch (InterruptedException e) {\n            Thread.currentThread().interrupt();\n            throw new TaskException(\"Execute emr task failed\", e);\n        } finally {\n            final int exitStatusCode = calculateExitStatusCode(clusterStatus);\n            setExitStatusCode(exitStatusCode);\n            log.info(\"emr task finished with cluster status : {}\", clusterStatus);\n        }\n    }\n\n    /**\n     * parse json string to RunJobFlowRequest\n     *\n     * @return RunJobFlowRequest\n     */\n    protected RunJobFlowRequest createRunJobFlowRequest() {\n\n        final RunJobFlowRequest runJobFlowRequest;\n        String jobFlowDefineJson = null;\n        try {\n            jobFlowDefineJson = ParameterUtils.convertParameterPlaceholders(","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-task-plugin/dolphinscheduler-task-emr/src/main/java/org/apache/dolphinscheduler/plugin/task/emr/EmrJobFlowTask.java#L90-L126","documentation":"A catch-all in EmrJobFlowTask.trackApplicationStatus for non-SDK exceptions raised while polling the cluster status loop (getClusterStatus, sleep-based waiting) — e.g. an IllegalStateException from an unexpected cluster state mapping or a runtime error in status interpretation. SDK errors are logged separately; this branch rethrows as a generic task-execution failure with the cause attached.","triggerScenarios":"Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-emr/src/main/java/org/apache/dolphinscheduler/plugin/task/emr/EmrJobFlowTask.java:108 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the caused-by exception to identify which status/state mapping failed","Check the EMR cluster's actual state in the AWS console — a state outside the waiting/terminal sets triggers the failure path","Handle the cluster state in the exit-code switch or report the state via the AWS API"],"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"}