apache/dolphinscheduler · error · TaskException

sagemaker applicationID is null

Error message

sagemaker applicationID is null

What it means

initPipelineId() lazily deserializes the stored appId JSON into a PipelineId; if it is still null it throws TaskException("sagemaker applicationID is null"). It means cancelApplication or trackApplicationStatus ran before submitApplication ever recorded a SageMaker pipeline id.

Source

Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-sagemaker/src/main/java/org/apache/dolphinscheduler/plugin/task/sagemaker/SagemakerTask.java:155

    @Override
    public void trackApplicationStatus() throws TaskException {
        initPipelineId();
        // Keep checking the health status
        exitStatusCode = utils.checkPipelineExecutionStatus(client, pipelineId);
    }

    /**
     * init sagemaker applicationId if null
     */
    private void initPipelineId() {
        if (pipelineId == null) {
            if (StringUtils.isNotEmpty(getAppIds())) {
                pipelineId = JSONUtils.parseObject(getAppIds(), PipelineUtils.PipelineId.class);
            }
        }
        if (pipelineId == null) {
            throw new TaskException("sagemaker applicationID is null");
        }
    }

    public StartPipelineExecutionRequest createStartPipelineRequest() throws SagemakerTaskException {

        String requestJson = parameters.getSagemakerRequestJson();
        requestJson = parseRequstJson(requestJson);

        StartPipelineExecutionRequest startPipelineRequest;
        try {
            startPipelineRequest = objectMapper.readValue(requestJson, StartPipelineExecutionRequest.class);
        } catch (Exception e) {
            log.error("can not parse SagemakerRequestJson from json: {}", requestJson);
            throw new SagemakerTaskException("can not parse SagemakerRequestJson ", e);
        }

        log.info("Sagemaker task create StartPipelineRequest: {}", startPipelineRequest);
        return startPipelineRequest;

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Check whether setAppIds() was reached during submitApplication; if the task was killed mid-submit there is genuinely no pipeline to stop — treat as a no-op.
  2. Log/examine the stored appId value; if it is malformed JSON fix whatever corrupted the appIds string.
  3. Retry status tracking after submit completes so the pipeline id is available.
  4. If caused by worker restart, re-run the task rather than cancelling.

Example fix

// before
cancelApplication() // throws when submitted-appIds never set
// after
if (StringUtils.isEmpty(getAppIds())) {
    log.warn("sagemaker applicationID not set; nothing to cancel");
    return;
}
Defensive patterns

Strategy: type-guard

Validate before calling

if (StringUtils.isEmpty(task.getAppIds())) {
    log.warn("No SageMaker pipeline id recorded; skip cancel/track");
    return;
}

Type guard

PipelineId pid = StringUtils.isNotEmpty(getAppIds())
        ? JSONUtils.parseObject(getAppIds(), PipelineUtils.PipelineId.class)
        : null;
if (pid == null) {
    // handle absence instead of proceeding
}

Try / catch

try {
    task.trackApplicationStatus();
} catch (TaskException e) {
    if (e.getMessage().contains("applicationID is null")) {
        log.warn("Submit never completed; treating task as not started");
    } else throw e;
}

Prevention

When it happens

Trigger: cancelApplication() or trackApplicationStatus() is invoked while getAppIds() is empty — e.g. task killed during init/submit before setAppIds() ran, or the stored appId JSON failed to parse back into PipelineUtils.PipelineId.

Common situations: User kills a SageMaker task milliseconds after launch, worker crash/restart wiped the in-memory pipelineId before the appId was persisted, or getAppIds() contains malformed JSON so parseObject returns null.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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