{"record":{"id":"9313abe4c95bdd96","repo":"apache/dolphinscheduler","slug":"failed-to-create-a-replicationtask","errorCode":null,"errorMessage":"Failed to create a ReplicationTask","messagePattern":"Failed to create a ReplicationTask","errorType":"exception","errorClass":"TaskException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-task-plugin/dolphinscheduler-task-dms/src/main/java/org/apache/dolphinscheduler/plugin/task/dms/DmsTask.java","lineNumber":89,"sourceCode":"    @Override\n    public void init() throws TaskException {\n        parameters = JSONUtils.parseObject(taskExecutionContext.getTaskParams(), DmsParameters.class);\n        log.info(\"Initialize Dms task params {}\", JSONUtils.toPrettyJsonString(parameters));\n        initDmsHook();\n    }\n\n    @Override\n    public List<String> getApplicationIds() throws TaskException {\n        return Collections.emptyList();\n    }\n\n    @Override\n    public void submitApplication() throws TaskException {\n        exitStatusCode = checkCreateReplicationTask();\n        if (exitStatusCode == TaskConstants.EXIT_CODE_SUCCESS) {\n            exitStatusCode = startReplicationTask();\n        } else {\n            throw new TaskException(\"Failed to create a ReplicationTask\");\n        }\n\n        // if the task is not running, the task will be deleted\n        if (exitStatusCode == TaskConstants.EXIT_CODE_FAILURE && !parameters.getIsRestartTask()) {\n            dmsHook.deleteReplicationTask();\n        } else {\n            appId = dmsHook.getApplicationIds();\n            setAppIds(JSONUtils.toJsonString(appId));\n        }\n    }\n\n    @Override\n    public void trackApplicationStatus() {\n        initAppId();\n        dmsHook.setReplicationTaskArn(appId.getReplicationTaskArn());\n        // if CdcStopPosition is not set, the task will not continue to check the running status\n        if (isStopTaskWhenCdc()) {\n            log.info(","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-task-plugin/dolphinscheduler-task-dms/src/main/java/org/apache/dolphinscheduler/plugin/task/dms/DmsTask.java#L71-L107","documentation":"DmsTask.submitApplication() first creates the AWS DMS replication task via checkCreateReplicationTask(). If creation did not succeed (exitStatusCode != EXIT_CODE_SUCCESS), it throws TaskException('Failed to create a ReplicationTask'). It signals the DMS CreateReplicationTask API call failed or returned an unusable result, before any start attempt.","triggerScenarios":"checkCreateReplicationTask() returns a failure exit status — e.g. DMS API error, invalid replication task config (bad source/target endpoint ARNs, invalid table mappings JSON), IAM permission failure, or a task with the same name already exists.","commonSituations":"Misconfigured source/target endpoint ARNs; malformed table mappings; IAM role lacking dms:CreateReplicationTask; duplicate task name in the region; source/target endpoints not tested/available.","solutions":["Read the DMS hook logs above the exception for the exact DMS API error (ARNT found, access denied, duplicate task name).","Validate endpoint ARNs, replication instance ARN, and table mappings JSON in the task params.","Check IAM permissions for dms:CreateReplicationTask and endpoint connectivity tests in the AWS console.","If a task with the same name exists, delete it or rename the new task, then rerun."],"exampleFix":"// before: invalid endpoint ARN\n{\"sourceEndpointArn\":\"arn:aws:dms:us-east-1:123:endpoint:OLD\",\"targetEndpointArn\":\"arn:aws:dms:us-east-1:123:endpoint:TGT\"}\n// after: valid, tested endpoints\n{\"sourceEndpointArn\":\"arn:aws:dms:us-east-1:123:endpoint:SRC123\",\"targetEndpointArn\":\"arn:aws:dms:us-east-1:123:endpoint:TGT456\"}","handlingStrategy":"try-catch","validationCode":"// pre-validate inputs via AWS CLI before submitting\naws dms describe-endpoints --filters Name=endpoint-id,Values=${srcId} ${tgtId}\naws dms describe-replication-tasks --filters Name=replication-task-id,Values=${taskId} # duplicate check","typeGuard":null,"tryCatchPattern":"try {\n    task.submitApplication();\n} catch (TaskException e) {\n    log.error(\"DMS create failed: check endpoint ARNs, table mappings, IAM and duplicate task names\");\n}","preventionTips":["Test source/target endpoints in the AWS DMS console before automation.","Validate table mappings JSON schema before task creation.","Ensure the worker's IAM role has dms:CreateReplicationTask.","Use unique replication task names per run or delete existing ones (isRestartTask)."],"tags":["dms","aws","task-creation"],"backgroundTag":"api-error-response","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}