apache/dolphinscheduler · error · SagemakerTaskException

Sagemaker task params is not valid

Error message

Sagemaker task params is not valid

What it means

SagemakerTask.init() parses the task's JSON params into SagemakerParameters and calls checkParameters(); when the validation fails it throws SagemakerTaskException with this message. It means required SageMaker task fields (e.g. sagemakerRequestJson, datasource type/connection) are missing or inconsistent, so the task cannot build a StartPipelineExecutionRequest.

Source

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

    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();
    }

    @Override
    public void submitApplication() throws TaskException {
        try {

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Open the SageMaker task definition and fill in the required fields (sagemakerRequestJson, datasource) then save and re-run.
  2. Validate the task params JSON locally: deserialize into SagemakerParameters and call checkParameters() to see what is missing.
  3. Check server logs for the JSONUtils.parseObject result to distinguish 'params is empty' (parse produced null) from 'params is not valid'.
  4. If params come from an older workflow, re-edit the task in the current DS version so defaults are regenerated.

Example fix

// before: task saved with empty request json
{"localParams":[],"resourceList":[],"type":"AWS_SAGEMAKER","sagemakerRequestJson":""}
// after
{"localParams":[],"resourceList":[],"type":"AWS_SAGEMAKER","sagemakerRequestJson":"{\"PipelineName\":\"my-pipeline\",\"ClientRequestToken\":\"abc\"}"}
Defensive patterns

Strategy: validation

Validate before calling

SagemakerParameters p = JSONUtils.parseObject(taskParams, SagemakerParameters.class);
if (p == null || !p.checkParameters()) {
    throw new IllegalStateException("SageMaker task params missing or invalid; check sagemakerRequestJson and datasource");
}

Try / catch

try {
    task.init();
} catch (SagemakerTaskException e) {
    log.error("SageMaker params invalid, fix task definition", e);
    // mark task failed without retry
}

Prevention

When it happens

Trigger: SagemakerParameters.checkParameters() returns false after JSONUtils.parseObject successfully deserialized the params — typically when sagemakerRequestJson is blank or the defined datasource type does not match a known DbType.

Common situations: Users leave the SageMaker request JSON empty in the task form, paste invalid JSON that serializes with null required fields, or switch task versions so older stored params no longer satisfy newer checkParameters() rules.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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