apache/dolphinscheduler · error · SagemakerTaskException

can not parse SagemakerRequestJson

Error message

can not parse SagemakerRequestJson 

What it means

createStartPipelineRequest() deserializes parameters.getSagemakerRequestJson() into an AWS StartPipelineExecutionRequest with ObjectMapper; any parse failure is logged and rethrown as SagemakerTaskException("can not parse SagemakerRequestJson "). It means the user-supplied request JSON is not valid for the AWS SDK model.

Source

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

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

    @Override
    public SagemakerParameters getParameters() {
        return parameters;
    }

    private String parseRequstJson(String requestJson) {
        Map<String, Property> paramsMap = taskRequest.getPrepareParamsMap();
        return ParameterUtils.convertParameterPlaceholders(requestJson, ParameterUtils.convert(paramsMap));
    }

    protected AmazonSageMaker createClient() {
        Map<String, String> awsProperties = PropertyUtils.getByPrefix("aws.sagemaker.", "");

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Copy the logged 'requestJson' from the error line and validate it with a JSON linter (jq, jsonlint).
  2. Compare the JSON against the AWS SDK's StartPipelineExecutionRequest schema — field names and types must match exactly.
  3. Fix type errors (e.g. PipelineParameters as an array of {Name,Value} objects, not strings).
  4. Re-paste the JSON into the task form carefully, ensuring the UI doesn't double-escape it, then save and re-run.

Example fix

// before
{"PipelineName":"p","PipelineParameters":"a,b"} // string not accepted
// after
{"PipelineName":"p","PipelineParameters":[{"Name":"env","Value":"prod"}]}
Defensive patterns

Strategy: validation

Validate before calling

// client-side pre-check of the request JSON
try {
    new ObjectMapper().readValue(sagemakerRequestJson, StartPipelineExecutionRequest.class);
} catch (JsonProcessingException e) {
    throw new IllegalArgumentException("Fix sagemakerRequestJson: " + e.getOriginalMessage());
}

Try / catch

try {
    task.handle(null);
} catch (SagemakerTaskException e) {
    log.error("sagemakerRequestJson unparseable — validate with jq and AWS SDK schema", e);
}

Prevention

When it happens

Trigger: objectMapper.readValue(requestJson, StartPipelineExecutionRequest.class) throws JsonProcessingException: the JSON is syntactically invalid, or fields don't match the SDK model (unknown fields fail only if FAIL_ON_UNKNOWN_PROPERTIES is on; wrong types always fail).

Common situations: Users paste AWS CLI-style JSON with comments or trailing commas, use camelCase from an old SDK doc, wrap the JSON in quotes accidentally, or the DS UI escapes the JSON incorrectly.

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/1425eeb37b56a687. Report an issue: GitHub.