{"record":{"id":"e6d22ab639e381ea","repo":"apache/dolphinscheduler","slug":"fetch-step-status-failed","errorCode":null,"errorMessage":"fetch step status failed","messagePattern":"fetch step 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/EmrAddStepsTask.java","lineNumber":180,"sourceCode":"            String state = stepStatus.getState();\n            StepState stepState = StepState.valueOf(state);\n            switch (stepState) {\n                case COMPLETED:\n                    return TaskConstants.EXIT_CODE_SUCCESS;\n                case CANCELLED:\n                    return TaskConstants.EXIT_CODE_KILL;\n                default:\n                    return TaskConstants.EXIT_CODE_FAILURE;\n            }\n        }\n\n    }\n\n    private StepStatus getStepStatus() {\n        DescribeStepRequest describeStepRequest = new DescribeStepRequest().withClusterId(clusterId).withStepId(stepId);\n        DescribeStepResult result = emrClient.describeStep(describeStepRequest);\n        if (result == null) {\n            throw new EmrTaskException(\"fetch step status failed\");\n        }\n        StepStatus stepStatus = result.getStep().getStatus();\n        log.info(\"emr step [clusterId:{}, stepId:{}] running with status:{}\", clusterId, stepId, stepStatus);\n        return stepStatus;\n\n    }\n\n    @Override\n    public void cancelApplication() throws TaskException {\n        log.info(\"trying cancel emr step, taskId:{}, clusterId:{}, stepId:{}\",\n                this.taskExecutionContext.getTaskInstanceId(), clusterId, stepId);\n        CancelStepsRequest cancelStepsRequest = new CancelStepsRequest().withClusterId(clusterId).withStepIds(stepId);\n        CancelStepsResult cancelStepsResult = emrClient.cancelSteps(cancelStepsRequest);\n\n        if (cancelStepsResult == null) {\n            throw new EmrTaskException(\"cancel emr step failed\");\n        }\n","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-task-plugin/dolphinscheduler-task-emr/src/main/java/org/apache/dolphinscheduler/plugin/task/emr/EmrAddStepsTask.java#L162-L198","documentation":"getStepStatus caught an AWS SDK exception while calling emrClient.describeStep (or the result came back null), so the step's current state could not be fetched. Causes include expired AWS credentials, EMR API throttling, the cluster/step having been terminated externally, or transient network failure. The message is the generic sentinel 'fetch step status failed'; the caused-by exception carries the SDK detail.","triggerScenarios":"Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-emr/src/main/java/org/apache/dolphinscheduler/plugin/task/emr/EmrAddStepsTask.java:180 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the caused-by SdkBaseException for auth, throttling, or not-found detail","Verify the EMR cluster and step still exist (external termination makes describeStep fail)","Retry status tracking after transient throttling/network errors","Confirm the task's AWS credentials and region configuration are valid"],"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"}