apache/dolphinscheduler · error · EmrTaskException

fetch step status failed

Error message

fetch step status failed

What it means

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.

Source

Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-emr/src/main/java/org/apache/dolphinscheduler/plugin/task/emr/EmrAddStepsTask.java:180

            String state = stepStatus.getState();
            StepState stepState = StepState.valueOf(state);
            switch (stepState) {
                case COMPLETED:
                    return TaskConstants.EXIT_CODE_SUCCESS;
                case CANCELLED:
                    return TaskConstants.EXIT_CODE_KILL;
                default:
                    return TaskConstants.EXIT_CODE_FAILURE;
            }
        }

    }

    private StepStatus getStepStatus() {
        DescribeStepRequest describeStepRequest = new DescribeStepRequest().withClusterId(clusterId).withStepId(stepId);
        DescribeStepResult result = emrClient.describeStep(describeStepRequest);
        if (result == null) {
            throw new EmrTaskException("fetch step status failed");
        }
        StepStatus stepStatus = result.getStep().getStatus();
        log.info("emr step [clusterId:{}, stepId:{}] running with status:{}", clusterId, stepId, stepStatus);
        return stepStatus;

    }

    @Override
    public void cancelApplication() throws TaskException {
        log.info("trying cancel emr step, taskId:{}, clusterId:{}, stepId:{}",
                this.taskExecutionContext.getTaskInstanceId(), clusterId, stepId);
        CancelStepsRequest cancelStepsRequest = new CancelStepsRequest().withClusterId(clusterId).withStepIds(stepId);
        CancelStepsResult cancelStepsResult = emrClient.cancelSteps(cancelStepsRequest);

        if (cancelStepsResult == null) {
            throw new EmrTaskException("cancel emr step failed");
        }

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Inspect the caused-by SdkBaseException for auth, throttling, or not-found detail
  2. Verify the EMR cluster and step still exist (external termination makes describeStep fail)
  3. Retry status tracking after transient throttling/network errors
  4. Confirm the task's AWS credentials and region configuration are valid
Defensive patterns

Strategy: try-catch

When it happens

Trigger: 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.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06). Data as JSON: /api/errors/e6d22ab639e381ea. Report an issue: GitHub.