apache/dolphinscheduler · error · ServiceException
50030
50030
Error message
task definition [{0}] does not exist What it means
Thrown when task relations reference postTaskCode values that have no matching task definition in the submitted taskDefinitionJson. The code computes the set difference between relation post-codes and task-node codes and rejects the request listing the missing codes.
Source
Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkflowDefinitionServiceImpl.java:415
log.error("Generate task relation list failed the taskRelation list is empty, taskRelationJson: {}",
taskRelationJson);
throw new ServiceException(Status.DATA_IS_NOT_VALID);
}
List<WorkflowTaskRelation> workflowTaskRelations = taskRelationList.stream()
.map(workflowTaskRelationLog -> JSONUtils.parseObject(
JSONUtils.toJsonString(workflowTaskRelationLog),
WorkflowTaskRelation.class))
.collect(Collectors.toList());
List<TaskNode> taskNodeList = processService.transformTask(workflowTaskRelations, taskDefinitionLogs);
if (taskNodeList.size() != taskRelationList.size()) {
Set<Long> postTaskCodes = taskRelationList.stream().map(WorkflowTaskRelationLog::getPostTaskCode)
.collect(Collectors.toSet());
Set<Long> taskNodeCodes = taskNodeList.stream().map(TaskNode::getCode).collect(Collectors.toSet());
Collection<Long> codes = CollectionUtils.subtract(postTaskCodes, taskNodeCodes);
if (CollectionUtils.isNotEmpty(codes)) {
String taskCodes = StringUtils.join(codes, Constants.COMMA);
log.error("Task definitions do not exist, taskCodes:{}.", taskCodes);
throw new ServiceException(Status.TASK_DEFINE_NOT_EXIST, taskCodes);
}
}
if (graphHasCycle(taskNodeList)) {
log.error("workflow DAG has cycle.");
throw new ServiceException(Status.WORKFLOW_NODE_HAS_CYCLE);
}
// check whether the task relation json is normal
for (WorkflowTaskRelationLog workflowTaskRelationLog : taskRelationList) {
if (workflowTaskRelationLog.getPostTaskCode() == 0) {
log.error("The post_task_code or post_task_version of workflowTaskRelationLog can not be zero, " +
"workflowTaskRelationLogId:{}.", workflowTaskRelationLog.getId());
throw new ServiceException(Status.CHECK_WORKFLOW_TASK_RELATION_ERROR);
}
}
return taskRelationList;
} catch (ServiceException ex) {
throw ex;View on GitHub (pinned to 02eac45a1b)
Solutions
- Add a task definition with the reported missing code to taskDefinitionJson
- Remove or fix the relation entries referencing the missing task codes
- Regenerate both JSONs together from the workflow designer so codes stay consistent
Example fix
// before
relations contain postTaskCode=111 but no definition with code 111
// after
either add {"code":111,...} to taskDefinitionJson or delete the relation with postTaskCode=111 Defensive patterns
Strategy: validation
Validate before calling
Set<Long> defCodes = defs.stream().map(TaskDefinitionLog::getCode).collect(Collectors.toSet());
List<Long> missing = relations.stream().map(WorkflowTaskRelationLog::getPostTaskCode).filter(c -> !defCodes.contains(c)).collect(Collectors.toList());
if (!missing.isEmpty()) throw new IllegalArgumentException("missing task definitions: " + missing); Try / catch
try { ... } catch (ServiceException e) { if (e.getCode() == 50030) { /* e.getMessage() lists missing codes; fix relations or add defs */ } } Prevention
- Keep relation and definition JSON generated together from one source
- Remove relations when deleting a task
- Cross-check codes after merging workflows
When it happens
Trigger: updateWorkflowDefinition/importWorkflowDefinition where taskRelationJson mentions a task code absent from taskDefinitionJson — e.g. a relation kept for a deleted task, or codes copied from a different workflow.
Common situations: Deleting a task in the UI but exporting stale relation JSON; editing JSON manually and forgetting to remove the relation of a removed task; merging workflows so codes no longer line up.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/1d875cd80f35adbb.
Report an issue: GitHub.