{"record":{"id":"83dac8875abbffe4","repo":"apache/dolphinscheduler","slug":"dms-applicationid-is-null","errorCode":null,"errorMessage":"DMS applicationID is null","messagePattern":"DMS applicationID is null","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":131,"sourceCode":"        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 {\n\n        // if IsRestartTask, return success, do not create replication task\n        if (parameters.getIsRestartTask()) {\n            return TaskConstants.EXIT_CODE_SUCCESS;\n        }\n\n        // if not IsRestartTask, create replication task\n        Boolean isCreateSuccessfully;\n        try {\n            isCreateSuccessfully = dmsHook.createReplicationTask();\n        } catch (Exception e) {\n            throw new TaskException(\"DMS task create replication task error\", e);\n        }\n","sourceCodeStart":113,"sourceCodeEnd":149,"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#L113-L149","documentation":"Private helper initAppId in DmsTask ensures an ApplicationIds object (containing the DMS replication task ARN) is available before tracking status. It loads the persisted appId, then the task's stored appIds string; if both are absent it throws 'DMS applicationID is null', because tracking cannot proceed without the remote application identifier.","triggerScenarios":"trackApplicationStatus runs but this.appId is null AND getAppIds() returns null/empty — e.g. the task is resumed/failover-tracked and no application ID was persisted by a previous submitApplication run.","commonSituations":"Worker failover after submitApplication crashed before setAppIds(JSONUtils.toJsonString(appId)) persisted; the workflow was defined as a tracking/restart task without a prior successful create/start; appId JSON was lost between task instances.","solutions":["Ensure the task instance's appIds were persisted: let submitApplication complete so setAppIds(JSONUtils.toJsonString(dmsHook.getApplicationIds())) runs before tracking.","If this is a restart task, verify IsRestartTask config and that the original replication task still exists in AWS so describeReplicationTasks can recover the ARN.","Re-run the workflow from the create/start step instead of resuming at the tracking step.","Check the DB/dolphinscheduler task instance record — appIds column should hold {\"replicationTaskArn\": ...} JSON."],"exampleFix":"// before (submitApplication interrupted before persisting)\nappId = dmsHook.getApplicationIds();\nsetAppIds(JSONUtils.toJsonString(appId)); // never executed\n// after: persist immediately after successful start, before any tracking can occur\nif (exitStatusCode == TaskConstants.EXIT_CODE_SUCCESS) {\n    appId = dmsHook.getApplicationIds();\n    setAppIds(JSONUtils.toJsonString(appId));\n}","handlingStrategy":"validation","validationCode":"// caller-side check before a tracking/restart run\nString appIds = taskInstance.getAppIds();\nif (appIds == null || appIds.isEmpty()) {\n    throw new IllegalStateException(\"No persisted DMS applicationIds; re-run from create/start step\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    trackApplicationStatus();\n} catch (TaskException e) {\n    if (e.getMessage().contains(\"applicationID is null\")) {\n        // restart from submitApplication instead of tracking\n    }\n}","preventionTips":["Never manually edit task instance appIds fields in the DB.","Keep IsRestartTask aligned with whether a prior run actually created the replication task.","Design failover/recovery to resume from the submit step when appIds is absent.","Verify persistence of setAppIds before enabling tracking-only runs."],"tags":["aws","dms","missing-application-id","task-tracking","state-loss"],"backgroundTag":"missing-required-config-field","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"}