apache/dolphinscheduler · error · TaskException

DMS applicationID is null

Error message

DMS applicationID is null

What it means

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.

Source

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

        Boolean isFinishedSuccessfully = dmsHook.checkFinishedReplicationTask();
        if (isFinishedSuccessfully) {
            exitStatusCode = TaskConstants.EXIT_CODE_SUCCESS;
        } else {
            throw new TaskException("DMS task failed to track");
        }
    }

    /**
     * init DMS remote AppId if null
     */
    private void initAppId() {
        if (appId == null) {
            if (StringUtils.isNotEmpty(getAppIds())) {
                appId = JSONUtils.parseObject(getAppIds(), DmsHook.ApplicationIds.class);
            }
        }
        if (appId == null) {
            throw new TaskException("DMS applicationID is null");
        }
    }

    public int checkCreateReplicationTask() throws TaskException {

        // if IsRestartTask, return success, do not create replication task
        if (parameters.getIsRestartTask()) {
            return TaskConstants.EXIT_CODE_SUCCESS;
        }

        // if not IsRestartTask, create replication task
        Boolean isCreateSuccessfully;
        try {
            isCreateSuccessfully = dmsHook.createReplicationTask();
        } catch (Exception e) {
            throw new TaskException("DMS task create replication task error", e);
        }

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Ensure the task instance's appIds were persisted: let submitApplication complete so setAppIds(JSONUtils.toJsonString(dmsHook.getApplicationIds())) runs before tracking.
  2. 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.
  3. Re-run the workflow from the create/start step instead of resuming at the tracking step.
  4. Check the DB/dolphinscheduler task instance record — appIds column should hold {"replicationTaskArn": ...} JSON.

Example fix

// before (submitApplication interrupted before persisting)
appId = dmsHook.getApplicationIds();
setAppIds(JSONUtils.toJsonString(appId)); // never executed
// after: persist immediately after successful start, before any tracking can occur
if (exitStatusCode == TaskConstants.EXIT_CODE_SUCCESS) {
    appId = dmsHook.getApplicationIds();
    setAppIds(JSONUtils.toJsonString(appId));
}
Defensive patterns

Strategy: validation

Validate before calling

// caller-side check before a tracking/restart run
String appIds = taskInstance.getAppIds();
if (appIds == null || appIds.isEmpty()) {
    throw new IllegalStateException("No persisted DMS applicationIds; re-run from create/start step");
}

Try / catch

try {
    trackApplicationStatus();
} catch (TaskException e) {
    if (e.getMessage().contains("applicationID is null")) {
        // restart from submitApplication instead of tracking
    }
}

Prevention

When it happens

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

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

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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