{"record":{"id":"1d6f5a34a7fa4a41","repo":"apache/dolphinscheduler","slug":"dms-task-failed-to-track","errorCode":null,"errorMessage":"DMS task failed to track","messagePattern":"DMS task failed to track","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":117,"sourceCode":"    }\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(\n                    \"This is a cdc task and cdcStopPosition is not set, the task will not continue to check the running status\");\n            exitStatusCode = TaskConstants.EXIT_CODE_SUCCESS;\n            return;\n        }\n\n        Boolean isFinishedSuccessfully = dmsHook.checkFinishedReplicationTask();\n        if (isFinishedSuccessfully) {\n            exitStatusCode = TaskConstants.EXIT_CODE_SUCCESS;\n        } else {\n            throw new TaskException(\"DMS task failed to track\");\n        }\n    }\n\n    /**\n     * init DMS remote AppId if null\n     */\n    private void initAppId() {\n        if (appId == null) {\n            if (StringUtils.isNotEmpty(getAppIds())) {\n                appId = JSONUtils.parseObject(getAppIds(), DmsHook.ApplicationIds.class);\n            }\n        }\n        if (appId == null) {\n            throw new TaskException(\"DMS applicationID is null\");\n        }\n    }\n\n    public int checkCreateReplicationTask() throws TaskException {","sourceCodeStart":99,"sourceCodeEnd":135,"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#L99-L135","documentation":"DmsTask.trackApplicationStatus polls AWS DMS to see whether the replication task finished successfully (dmsHook.checkFinishedReplicationTask). If the check returns false — the replication task did not reach a successfully-finished state — a TaskException with this message is thrown so the worker marks the task failed.","triggerScenarios":"Called during task tracking: the DMS replication task exists and has an ARN, but checkFinishedReplicationTask() returns false, i.e. the replication task status is not 'finished/completed' (it failed, stopped, or is still running without reaching the success state).","commonSituations":"The DMS replication task actually failed in AWS (source/target endpoint connectivity, table errors, full-load errors); cdcStopPosition was set to a position that is never reached so the task never finishes; insufficient DMS IAM permissions causing describe/modify calls to report non-success; the replication task was manually stopped in the AWS console.","solutions":["Check the replication task in the AWS DMS console for its actual status and failure reason, fix the underlying replication error (endpoints, table mappings, network).","If running a CDC task, verify cdcStopPosition is set to a valid, reachable position or remove it so tracking is skipped (isStopTaskWhenCdc path).","Verify the IAM credentials/role used by DmsHook have dms:DescribeReplicationTasks and related permissions so status checks report accurately.","Re-run the task with IsRestartTask if the underlying data is consistent and the task can be restarted."],"exampleFix":"// before: task keeps polling a CDC position that never completes\n\"cdcStopPosition\": \"mysql-bin-changelog.000000:never\"\n// after: use a real binlog position or omit it to skip status tracking\n\"cdcStopPosition\": \"mysql-bin-changelog.012345:0010\" || omit","handlingStrategy":"try-catch","validationCode":"// before scheduling tracking, ensure the replication task finished successfully\nReplicationTask t = dmsHook.describeReplicationTasks();\nif (!\"COMPLETED\".equalsIgnoreCase(t.getStatus()) && !(\"cdc\".contains(t.getMigrationType().toLowerCase()) && params.getCdcStopPosition() != null)) {\n    throw new IllegalStateException(\"Replication not finished: \" + t.getStatus());\n}","typeGuard":null,"tryCatchPattern":"try {\n    trackApplicationStatus();\n} catch (TaskException e) {\n    // inspect DMS task status via describeReplicationTasks, alert, then retry or fail workflow\n}","preventionTips":["Always set a reachable cdcStopPosition for CDC tasks that must be tracked to completion.","Monitor DMS replication task status in AWS CloudWatch alongside the workflow.","Verify endpoint test connections before full-load runs.","Grant DMS read permissions to the credentials used by DmsHook."],"tags":["aws","dms","replication-task","task-tracking","task-failed"],"backgroundTag":"upstream-api-error","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"}