apache/dolphinscheduler · error · SagemakerTaskException

Sagemaker task params is empty

Error message

Sagemaker task params is empty

What it means

SagemakerTask.init parses taskRequest.getTaskParams() into SagemakerParameters with JSONUtils.parseObject; if the result is null (empty, missing, or unparseable params JSON) it throws SagemakerTaskException("Sagemaker task params is empty"). The task cannot proceed without its parameter object.

Solutions

  1. Open the Sagemaker task definition and re-enter/save the parameters so taskParams is populated.
  2. Inspect the task's taskParams JSON in the database/workflow definition for emptiness or syntax errors.
  3. Check server/plugin version consistency so param JSON field names match SagemakerParameters expectations.
  4. Validate the JSON with a linter if the workflow was hand-edited, then re-import the workflow.

Example fix

// before: empty params in task definition
{"sagemakerTaskParams":null}
// after: provide required params
{"sagemakerRequestJson":"{\"PipelineName\":\"my-pipeline\",...}","resourceList":[]}
Defensive patterns

Strategy: validation

Validate before calling

SagemakerParameters p = JSONUtils.parseObject(taskParams, SagemakerParameters.class);
if (p == null || !p.checkParameters()) {
    throw new IllegalArgumentException("Sagemaker taskParams missing or invalid — check workflow definition JSON");
}

Type guard

boolean hasParams(SagemakerParameters p) { return p != null && p.checkParameters(); }

Try / catch

try {
    sagemakerTask.init();
} catch (SagemakerTaskException e) {
    logger.error("Sagemaker params problem: {}. Dump taskParams for diagnosis", e.getMessage());
    throw e;
}

Prevention

When it happens

Trigger: init() is called with taskParams that are null, an empty string, or JSON that fails to deserialize into SagemakerParameters, causing JSONUtils.parseObject to return null.

Common situations: Sagemaker task saved with no parameters; workflow definition JSON corrupted or hand-edited; upgrading from a version with different param field names so deserialization yields null; JSON syntax errors in taskParams.

Understand the failure class

Background: "failed to unmarshal" / json.Unmarshal errors: why parsing a response into a Go struct fails and how to fix it — this error's family across 23 libraries.

Related errors


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

Appendix: source

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

    private SagemakerTaskExecutionContext sagemakerTaskExecutionContext;
    private TaskExecutionContext taskExecutionContext;

    public SagemakerTask(TaskExecutionContext taskExecutionContext) {
        super(taskExecutionContext);
        this.taskExecutionContext = taskExecutionContext;
    }

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

    @Override
    public void init() {

        parameters = JSONUtils.parseObject(taskRequest.getTaskParams(), SagemakerParameters.class);
        if (parameters == null) {
            throw new SagemakerTaskException("Sagemaker task params is empty");
        }
        if (!parameters.checkParameters()) {
            throw new SagemakerTaskException("Sagemaker task params is not valid");
        }
        sagemakerTaskExecutionContext =
                parameters.generateExtendedContext(taskExecutionContext.getResourceParametersHelper());
        sagemakerConnectionParam =
                (SagemakerConnectionParam) DataSourceUtils.buildConnectionParams(DbType.valueOf(parameters.getType()),
                        sagemakerTaskExecutionContext.getConnectionParams());
        parameters.setUsername(sagemakerConnectionParam.getUserName());
        parameters.setPassword(sagemakerConnectionParam.getPassword());
        parameters.setAwsRegion(sagemakerConnectionParam.getAwsRegion());
        log.info("Initialize Sagemaker task params {}", JSONUtils.toPrettyJsonString(parameters));

        client = createClient();
        utils = new PipelineUtils();
    }

View on GitHub (pinned to 02eac45a1b)