{"record":{"id":"cc3617ebf554e153","repo":"apache/dolphinscheduler","slug":"emr-task-submit-failed","errorCode":null,"errorMessage":"emr task submit failed","messagePattern":"emr task submit 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":86,"sourceCode":"    @Override\n    public void submitApplication() throws TaskException {\n        ClusterStatus clusterStatus = null;\n        try {\n            RunJobFlowRequest runJobFlowRequest = createRunJobFlowRequest();\n\n            // submit runJobFlowRequest to aws\n            RunJobFlowResult result = emrClient.runJobFlow(runJobFlowRequest);\n\n            clusterId = result.getJobFlowId();\n            // Failover on EMR Task type has not been implemented. In this time, DS only supports failover on yarn task\n            // type . Other task type, such as EMR task, k8s task not ready yet.\n            setAppIds(clusterId);\n\n            clusterStatus = getClusterStatus();\n\n        } catch (EmrTaskException | SdkBaseException e) {\n            log.error(\"emr task submit failed with error\", e);\n            throw new TaskException(\"emr task submit 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    @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) {","sourceCodeStart":68,"sourceCodeEnd":104,"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#L68-L104","documentation":"A catch-all in EmrJobFlowTask.submitApplication: creating the RunJobFlowRequest (bad jobFlowDefineJson) or calling emrClient.runJobFlow threw — invalid AWS credentials, insufficient IAM permission for elasticmapreduce:RunJobFlow, bad service role/instance profile, or an SDK error. The job flow was never started; clusterId remains unset and the task fails.","triggerScenarios":"Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-emr/src/main/java/org/apache/dolphinscheduler/plugin/task/emr/EmrJobFlowTask.java:86 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the caused-by exception: JsonProcessingException means bad jobFlowDefineJson; SdkBaseException means AWS-side failure","Fix the AWS credential/policy configuration (RunJobFlow, PassRole permissions, service role and instance profile ARNs)","Validate jobFlowDefineJson against the RunJobFlowRequest schema before running","Retry after transient AWS errors"],"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"}