apache/dolphinscheduler · error · ServiceException
50017
50017
Error message
data {0} not valid What it means
Thrown by generateTaskDefinitionList when the taskDefinitionJson request parameter cannot be parsed into any TaskDefinitionLog entries, or parses to an empty list. The API requires a valid, non-empty JSON array of task definitions when saving/updating a workflow. It signals malformed request payload data rather than a server fault.
Source
Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkflowDefinitionServiceImpl.java:363
workflowTaskLineage.setTaskDefinitionVersion(taskDefinitionLog.getVersion());
workflowTaskLineage.setDeptProjectCode(taskDefinitionLog.getProjectCode());
workflowTaskLineage.setDeptWorkflowDefinitionCode(dependentItem.getDefinitionCode());
workflowTaskLineage.setDeptTaskDefinitionCode(dependentItem.getDepTaskCode());
workflowTaskLineageList.add(workflowTaskLineage);
}
}
}
return workflowTaskLineageList;
}
private List<TaskDefinitionLog> generateTaskDefinitionList(String taskDefinitionJson) {
try {
List<TaskDefinitionLog> taskDefinitionLogs = JSONUtils.toList(taskDefinitionJson, TaskDefinitionLog.class);
if (CollectionUtils.isEmpty(taskDefinitionLogs)) {
log.error("Generate task definition list failed, the given taskDefinitionJson is invalided: {}",
taskDefinitionJson);
throw new ServiceException(Status.DATA_IS_NOT_VALID, taskDefinitionJson);
}
Set<String> taskNameSet = new HashSet<>();
for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogs) {
if (!taskNameSet.add(taskDefinitionLog.getName())) {
log.error(
"Generate task definition list failed, the given task definition name is duplicate, taskName: {}, taskDefinition: {}",
taskDefinitionLog.getName(), taskDefinitionLog);
throw new ServiceException(Status.TASK_NAME_DUPLICATE_ERROR, taskDefinitionLog.getName());
}
if (!checkTaskParameters(taskDefinitionLog.getTaskType(), taskDefinitionLog.getTaskParams())) {
log.error(
"Generate task definition list failed, the given task definition parameter is invalided, taskName: {}, taskDefinition: {}",
taskDefinitionLog.getName(), taskDefinitionLog);
throw new ServiceException(Status.WORKFLOW_NODE_S_PARAMETER_INVALID, taskDefinitionLog.getName());
}
}View on GitHub (pinned to 02eac45a1b)
Solutions
- Validate taskDefinitionJson is a non-empty JSON array of task-definition objects before calling the API
- Re-export the workflow definition from the source instance and use that JSON verbatim
- Check JSON syntax with a linter/parser (trailing commas, unquoted keys are common)
- Confirm you are on matching DolphinScheduler versions between export and import
Example fix
// before
callApi(taskDefinitionJson = "")
// after
List<TaskDefinitionLog> defs = JSONUtils.toList(json, TaskDefinitionLog.class);
if (CollectionUtils.isEmpty(defs)) { throw new IllegalArgumentException("taskDefinitionJson must be a non-empty array"); } Defensive patterns
Strategy: validation
Validate before calling
boolean valid = json != null && JSONUtils.toList(json, TaskDefinitionLog.class) != null && !JSONUtils.toList(json, TaskDefinitionLog.class).isEmpty();
if (!valid) throw new IllegalArgumentException("taskDefinitionJson must be a non-empty JSON array"); Type guard
static boolean isNonEmptyTaskDefinitionJson(String s) { List<TaskDefinitionLog> l = JSONUtils.toList(s, TaskDefinitionLog.class); return l != null && !l.isEmpty(); } Try / catch
try { api.updateWorkflowDefinition(...) } catch (ServiceException e) { if (e.getCode() == 50017) { /* fix taskDefinitionJson payload */ } } Prevention
- Always export JSON from the UI as a template
- Parse-then-send: validate JSON locally before the API call
- Pin matching versions across environments
When it happens
Trigger: Calling importWorkflowDefinition or updateWorkflowDefinition with taskDefinitionJson that is null, empty string, invalid JSON, valid JSON but not an array, or an empty array [].
Common situations: Hand-edited workflow JSON with a syntax error; exporting from one DolphinScheduler version and importing into another where the format changed; passing the wrong JSON field (e.g. relations instead of task definitions); forgetting to URL-encode the parameter in the REST call.
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/5eb4895dfa245778.
Report an issue: GitHub.