{"record":{"id":"0fb8e41d157f43ad","repo":"apache/dolphinscheduler","slug":"failed-to-get-job-run","errorCode":null,"errorMessage":"Failed to get job run!","messagePattern":"Failed to get 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":174,"sourceCode":"            } 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                }\n            }, retryPolicy);\n\n            currentState = RunState.valueOf(getJobRunResponse.getBody().getJobRun().getState());\n            log.info(\"job - {} state - {}\", jobRunId, currentState);\n\n            try {\n                Thread.sleep(10 * 1000L);\n            } catch (InterruptedException e) {\n                break;\n            }\n        }\n\n        setExitStatusCode(mapFinalStateToExitCode(currentState));\n    }\n\n    @Override\n    public void submitApplication() throws TaskException {","sourceCodeStart":156,"sourceCodeEnd":192,"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#L156-L192","documentation":"The Aliyun Serverless Spark task wraps any exception from the getJobRun API call into AliyunServerlessSparkTaskException with this message, then retries it per the retry policy. It means the polling call to query the job run's state failed (network, auth, or API error) and the actual job state could not be determined.","triggerScenarios":"aliyunServerlessSparkClient.getJobRun(workspaceId, jobRunId, getJobRunRequest) throws — invalid workspaceId, nonexistent/deleted jobRunId, expired or missing credentials, network partition, or Aliyun service throttling/outage.","commonSituations":"Wrong workspace ID in task config; the job run was cancelled/purged server-side while the task still polls it; AK/SK credentials rotated or lacking AliyunServerlessSpark permissions; intermittent connectivity from the worker to the Aliyun endpoint.","solutions":["Verify workspaceId and that the jobRunId exists in the Aliyun Serverless Spark console","Check the wrapped cause in the stack trace for the real SDK error (auth, throttle, 404)","Confirm the access key/secret are valid and have GetJobRun permissions","Increase/reconfigure the retry policy to tolerate transient throttling","Check worker network access to the Aliyun endpoint"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// before running\nif (params.getWorkspaceId() == null || params.getWorkspaceId().isEmpty()) {\n    throw new IllegalArgumentException(\"workspaceId is required\");\n}\n// verify credentials via a lightweight API call or config check","typeGuard":null,"tryCatchPattern":"try {\n    taskClient.run();\n} catch (TaskException e) {\n    if (e.getCause() instanceof AliyunServerlessSparkTaskException) {\n        log.error(\"Aliyun getJobRun failed: {}\", e.getCause().getMessage(), e);\n        // decide retry vs fail based on the underlying SDK error\n    }\n}","preventionTips":["Validate workspaceId and credentials before submitting","Grant least-privilege AK/SK with GetJobRun permission","Configure a retry policy tolerant of throttling","Monitor Aliyun service health/endpoints"],"tags":["aliyun","spark","api-call-failed","retry"],"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"}