apache/dolphinscheduler · error · ServiceException
10198
10198
Error message
task name {0} duplicate error What it means
Thrown when two or more task definitions in the submitted taskDefinitionJson share the same task name. Task names must be unique within a workflow definition, enforced via a HashSet during generation of the task definition list.
Source
Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkflowDefinitionServiceImpl.java:372
}
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());
}
}
return taskDefinitionLogs;
} catch (ServiceException ex) {
throw ex;
} catch (Exception e) {
log.error("Generate task definition list failed, meet an unknown exception", e);
throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR);
}
}
View on GitHub (pinned to 02eac45a1b)
Solutions
- Rename the duplicated task in taskDefinitionJson so every name is unique
- Re-generate the JSON from the workflow designer UI instead of editing raw JSON
- Search the JSON programmatically for duplicate name values before submitting
Example fix
// before
[{"name":"task1",...},{"name":"task1",...}]
// after
[{"name":"task1",...},{"name":"task2",...}] Defensive patterns
Strategy: validation
Validate before calling
Set<String> names = new HashSet<>(); for (TaskDefinitionLog d : defs) if (!names.add(d.getName())) throw new IllegalArgumentException("duplicate task name: " + d.getName()); Type guard
static boolean uniqueNames(List<TaskDefinitionLog> defs) { return defs.stream().map(TaskDefinitionLog::getName).distinct().count() == defs.size(); } Try / catch
try { ... } catch (ServiceException e) { if (e.getCode() == 10198) { log.error("duplicate task name: {}", e.getMessage()); } } Prevention
- Rename after copy-pasting task blocks
- Enforce unique naming in any JSON generator script
- Use the UI designer which blocks duplicate names client-side
When it happens
Trigger: Calling importWorkflowDefinition or updateWorkflowDefinition where two entries in taskDefinitionJson have identical name fields.
Common situations: Copy-pasting a task block in the workflow JSON and forgetting to rename it; script-generated JSON with a loop that reuses the name; merging workflows that had same-named tasks.
Related errors
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/bc8b0b0ebd6873df.
Report an issue: GitHub.