apache/dolphinscheduler · error · TaskException

Failed to create a ReplicationTask

Error message

Failed to create a ReplicationTask

What it means

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.

Source

Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-dms/src/main/java/org/apache/dolphinscheduler/plugin/task/dms/DmsTask.java:89

    @Override
    public void init() throws TaskException {
        parameters = JSONUtils.parseObject(taskExecutionContext.getTaskParams(), DmsParameters.class);
        log.info("Initialize Dms task params {}", JSONUtils.toPrettyJsonString(parameters));
        initDmsHook();
    }

    @Override
    public List<String> getApplicationIds() throws TaskException {
        return Collections.emptyList();
    }

    @Override
    public void submitApplication() throws TaskException {
        exitStatusCode = checkCreateReplicationTask();
        if (exitStatusCode == TaskConstants.EXIT_CODE_SUCCESS) {
            exitStatusCode = startReplicationTask();
        } else {
            throw new TaskException("Failed to create a ReplicationTask");
        }

        // if the task is not running, the task will be deleted
        if (exitStatusCode == TaskConstants.EXIT_CODE_FAILURE && !parameters.getIsRestartTask()) {
            dmsHook.deleteReplicationTask();
        } else {
            appId = dmsHook.getApplicationIds();
            setAppIds(JSONUtils.toJsonString(appId));
        }
    }

    @Override
    public void trackApplicationStatus() {
        initAppId();
        dmsHook.setReplicationTaskArn(appId.getReplicationTaskArn());
        // if CdcStopPosition is not set, the task will not continue to check the running status
        if (isStopTaskWhenCdc()) {
            log.info(

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Read the DMS hook logs above the exception for the exact DMS API error (ARNT found, access denied, duplicate task name).
  2. Validate endpoint ARNs, replication instance ARN, and table mappings JSON in the task params.
  3. Check IAM permissions for dms:CreateReplicationTask and endpoint connectivity tests in the AWS console.
  4. If a task with the same name exists, delete it or rename the new task, then rerun.

Example fix

// before: invalid endpoint ARN
{"sourceEndpointArn":"arn:aws:dms:us-east-1:123:endpoint:OLD","targetEndpointArn":"arn:aws:dms:us-east-1:123:endpoint:TGT"}
// after: valid, tested endpoints
{"sourceEndpointArn":"arn:aws:dms:us-east-1:123:endpoint:SRC123","targetEndpointArn":"arn:aws:dms:us-east-1:123:endpoint:TGT456"}
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-validate inputs via AWS CLI before submitting
aws dms describe-endpoints --filters Name=endpoint-id,Values=${srcId} ${tgtId}
aws dms describe-replication-tasks --filters Name=replication-task-id,Values=${taskId} # duplicate check

Try / catch

try {
    task.submitApplication();
} catch (TaskException e) {
    log.error("DMS create failed: check endpoint ARNs, table mappings, IAM and duplicate task names");
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06). Data as JSON: /api/errors/9313abe4c95bdd96. Report an issue: GitHub.