{"record":{"id":"73df081e8f6b013f","repo":"apache/dolphinscheduler","slug":"fetch-cluster-status-failed","errorCode":null,"errorMessage":"fetch cluster status failed","messagePattern":"fetch cluster status failed","errorType":"exception","errorClass":"EmrTaskException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-task-plugin/dolphinscheduler-task-emr/src/main/java/org/apache/dolphinscheduler/plugin/task/emr/EmrJobFlowTask.java","lineNumber":173,"sourceCode":"                    String code = stateChangeReason.getCode();\n                    if (code != null\n                            && code.equalsIgnoreCase(ClusterStateChangeReasonCode.ALL_STEPS_COMPLETED.toString())) {\n                        return TaskConstants.EXIT_CODE_SUCCESS;\n                    } else {\n                        return TaskConstants.EXIT_CODE_KILL;\n                    }\n                default:\n                    return TaskConstants.EXIT_CODE_FAILURE;\n            }\n        }\n\n    }\n\n    private ClusterStatus getClusterStatus() {\n        DescribeClusterRequest describeClusterRequest = new DescribeClusterRequest().withClusterId(clusterId);\n        DescribeClusterResult result = emrClient.describeCluster(describeClusterRequest);\n        if (result == null) {\n            throw new EmrTaskException(\"fetch cluster status failed\");\n        }\n        ClusterStatus clusterStatus = result.getCluster().getStatus();\n        log.info(\"emr cluster [clusterId:{}] running with status:{}\", clusterId, clusterStatus);\n        return clusterStatus;\n\n    }\n\n    @Override\n    public void cancelApplication() throws TaskException {\n        log.info(\"trying terminate job flow, taskId:{}, clusterId:{}\", this.taskExecutionContext.getTaskInstanceId(),\n                clusterId);\n        TerminateJobFlowsRequest terminateJobFlowsRequest = new TerminateJobFlowsRequest().withJobFlowIds(clusterId);\n        TerminateJobFlowsResult terminateJobFlowsResult = emrClient.terminateJobFlows(terminateJobFlowsRequest);\n        log.info(\"the result of terminate job flow is:{}\", terminateJobFlowsResult);\n    }\n\n}\n","sourceCodeStart":155,"sourceCodeEnd":191,"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#L155-L191","documentation":"getClusterStatus caught an AWS SDK exception while calling emrClient.describeCluster (or got a null result), so the EMR cluster's state could not be fetched for exit-code mapping. Typical causes: expired/invalid credentials, throttling, the cluster terminated and deleted outside DS, or network failure. The sentinel message 'fetch cluster status failed' wraps the SDK detail in the cause.","triggerScenarios":"Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-emr/src/main/java/org/apache/dolphinscheduler/plugin/task/emr/EmrJobFlowTask.java:173 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the caused-by SdkBaseException for auth/throttling/not-found detail","Verify the cluster (jobFlowId) still exists in AWS — externally deleted clusters make describeCluster fail","Retry status polling after transient throttling or network errors","Check the task's AWS credentials and region configuration"],"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-14T05:17:10.506Z"}