{"record":{"id":"025aa808bff58547","repo":"apache/dolphinscheduler","slug":"failed-to-start-job-run","errorCode":null,"errorMessage":"Failed to start job run! ","messagePattern":"Failed to start job run! ","errorType":"exception","errorClass":"AliyunServerlessSparkTaskException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-task-plugin/dolphinscheduler-task-aliyunserverlessspark/src/main/java/org/apache/dolphinscheduler/plugin/task/aliyunserverlessspark/AliyunServerlessSparkTask.java","lineNumber":157,"sourceCode":"        if (getTemplateResponse != null) {\n            templateConf = getTemplateResponse.getBody()\n                    .getData()\n                    .getSparkConf()\n                    .stream()\n                    .map(item -> \"--conf \" + item.getKey() + \"=\" + item.getValue())\n                    .collect(Collectors.joining(\" \"));\n\n            templateDisplayReleaseVersion = getTemplateResponse.getBody().getData().getDisplaySparkVersion();\n            templateFusion = getTemplateResponse.getBody().getData().getFusion();\n        }\n\n        StartJobRunRequest startJobRunRequest = buildStartJobRunRequest(aliyunServerlessSparkParameters);\n        StartJobRunResponse startJobRunResponse = RetryUtils.retryFunction(() -> {\n            try {\n                return aliyunServerlessSparkClient.startJobRun(\n                        aliyunServerlessSparkParameters.getWorkspaceId(), startJobRunRequest);\n            } catch (Exception e) {\n                throw new AliyunServerlessSparkTaskException(\"Failed to start job run! \", e);\n            }\n        }, retryPolicy);\n\n        jobRunId = startJobRunResponse.getBody().getJobRunId();\n        setAppIds(jobRunId);\n        log.info(\"Successfully submitted serverless spark job, jobRunId - {}\", jobRunId);\n\n        while (!RunState.isFinal(currentState)) {\n            GetJobRunRequest getJobRunRequest = buildGetJobRunRequest();\n\n            GetJobRunResponse getJobRunResponse = RetryUtils.retryFunction(() -> {\n                try {\n                    return aliyunServerlessSparkClient\n                            .getJobRun(aliyunServerlessSparkParameters.getWorkspaceId(), jobRunId,\n                                    getJobRunRequest);\n                } catch (Exception e) {\n                    throw new AliyunServerlessSparkTaskException(\"Failed to get job run!\", e);\n                }","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-task-plugin/dolphinscheduler-task-aliyunserverlessspark/src/main/java/org/apache/dolphinscheduler/plugin/task/aliyunserverlessspark/AliyunServerlessSparkTask.java#L139-L175","documentation":"In handle(), after building a StartJobRunRequest the task calls aliyunServerlessSparkClient.startJobRun inside RetryUtils.retryFunction; any exception is wrapped as AliyunServerlessSparkTaskException \"Failed to start job run!\" and the task fails after retries are exhausted.","triggerScenarios":"startJobRun API call failing due to invalid job configuration (SQL/file/parameters), insufficient quota or permissions in the workspace, throttling, or transient network errors persisting beyond the retryPolicy.","commonSituations":"Invalid Spark job template parameters or bad SQL; workspace quota exhausted; RAM role lacking StartJobRun permission; region/endpoint mismatch; Aliyun service-side errors (4xx/5xx) under load.","solutions":["Check the wrapped cause/logs to identify the Aliyun API error code (auth vs quota vs validation)","Validate the job template configuration and parameters used in buildStartJobRunRequest","Verify credentials/permissions for emr-serverless-spark:StartJobRun","Ensure workspace has available quota and the region/endpoint are correct; retry later if throttled"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Validate request before submitting\nif (startJobRunRequest == null || workspaceId == null || workspaceId.isEmpty()) {\n    throw new IllegalArgumentException(\"workspaceId and StartJobRunRequest must be valid before submit\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    task.handle();\n} catch (AliyunServerlessSparkTaskException e) {\n    if (e.getMessage().contains(\"Failed to start job run\")) {\n        log.error(\"Job submission failed; check Aliyun error code in cause\", e);\n        // fail the task execution status; do not blind-retry validation errors\n    }\n}","preventionTips":["Retry only transient errors; validate request/params to avoid retrying 4xx validation failures","Monitor workspace quota and job limits in Aliyun console","Ensure StartJobRun IAM permission and valid credentials","Alert on repeated submission failures to catch service-side incidents early"],"tags":["aliyun","task-plugin","job-submit","api-request"],"backgroundTag":"api-request-failed","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"}