{"record":{"id":"ba546e2faf80a79b","repo":"apache/dolphinscheduler","slug":"failed-to-get-template-info","errorCode":null,"errorMessage":"Failed to get template info","messagePattern":"Failed to get template info","errorType":"exception","errorClass":"TaskException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-task-plugin/dolphinscheduler-task-aliyunserverlessspark/src/main/java/org/apache/dolphinscheduler/plugin/task/aliyunserverlessspark/AliyunServerlessSparkTask.java","lineNumber":135,"sourceCode":"            aliyunServerlessSparkClient =\n                    buildAliyunServerlessSparkClient(accessKeyId, accessKeySecret, regionId, endpoint);\n        } catch (Exception e) {\n            log.error(\"Failed to build Aliyun-Serverless-Spark client!\", e);\n            throw new AliyunServerlessSparkTaskException(\"Failed to build Aliyun-Serverless-Spark client!\");\n        }\n\n        currentState = RunState.Submitted;\n    }\n\n    @Override\n    public void handle(TaskCallBack taskCallBack) throws TaskException {\n        GetTemplateResponse getTemplateResponse = RetryUtils.retryFunction(() -> {\n            try {\n                return aliyunServerlessSparkClient.getTemplate(\n                        aliyunServerlessSparkParameters.getWorkspaceId(),\n                        buildGetTemplateRequest());\n            } catch (Exception e) {\n                throw new TaskException(\"Failed to get template info\", e);\n            }\n        }, retryPolicy);\n\n        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 {","sourceCodeStart":117,"sourceCodeEnd":153,"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#L117-L153","documentation":"In handle(), the task fetches template info via aliyunServerlessSparkClient.getTemplate, wrapped in RetryUtils.retryFunction; any exception inside is wrapped as TaskException \"Failed to get template info\" and retried per the retryPolicy before ultimately failing the task.","triggerScenarios":"getTemplate call throwing — invalid workspaceId, template not found, expired/insufficient credentials (AccessDenied), network error, or API rate limiting — after exhausting retries.","commonSituations":"Wrong workspaceId or deleted job template in the parameters; RAM/token permissions lacking GetTemplate; Aliyun API throttling; worker host cannot reach the endpoint.","solutions":["Verify workspaceId and the template request (job template name/id) exist in the workspace","Check credentials/IAM permission for emr:GetTemplate","Inspect the wrapped cause (retry logs) to distinguish auth vs network vs throttling","Confirm endpoint reachability from the worker; add address to allowlist if firewalled"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Pre-flight: confirm workspace and template are reachable with current credentials\nGetTemplateResponse r = client.getTemplate(workspaceId, buildGetTemplateRequest()); // fail fast outside retry if config wrong\nif (r == null || r.getBody() == null) throw new IllegalStateException(\"Template missing in workspace \" + workspaceId);","typeGuard":null,"tryCatchPattern":"try {\n    task.handle();\n} catch (TaskException e) {\n    if (e.getMessage().contains(\"Failed to get template info\")) {\n        // inspect cause: auth vs not-found vs network; adjust creds/params before retry\n    }\n}","preventionTips":["Use a bounded retry policy with backoff for Aliyun API calls","Verify workspaceId/template exist before launching workflows","Grant RAM permissions for GetTemplate and check token expiry","Monitor worker->Aliyun endpoint connectivity"],"tags":["aliyun","task-plugin","api-request","network"],"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"}