apache/dolphinscheduler · error · java.lang.RuntimeException

The dependent task's taskDefinition is not exist, dependentI

Error message

The dependent task's taskDefinition is not exist, dependentItem: ${dependentItem}

What it means

For dependent items that reference a specific task (not DEPENDENT_ALL_TASK_CODE), initializeDependentTaskList looks the depTaskCode up in the task definition map; when absent it throws this RuntimeException because the specific dependency target cannot be evaluated.

Source

Thrown at dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/executor/plugin/dependent/DependentTaskTracker.java:189

                        }
                        if (dependentItem.getDepTaskCode() == Constants.DEPENDENT_ALL_TASK_CODE) {
                            log.info(
                                    "Add dependent all task, ProjectName: {}, WorkflowName: {}, WorkflowCode: {}, DependentCycle: {}, DependentCycleDate: {}, DependentRelation: {}",
                                    project.getName(), workflowDefinition.getName(), workflowDefinition.getCode(),
                                    dependentItem.getCycle(), dependentItem.getDateValue(),
                                    dependentTaskModel.getRelation());
                        } else if (dependentItem.getDepTaskCode() == Constants.DEPENDENT_WORKFLOW_CODE) {
                            log.info(
                                    "Add dependent workflow task, ProjectName: {}, WorkflowName: {}, WorkflowCode: {}, DependentCycle: {}, DependentCycleDate: {}, DependentRelation: {}",
                                    project.getName(), workflowDefinition.getName(), workflowDefinition.getCode(),
                                    dependentItem.getCycle(), dependentItem.getDateValue(),
                                    dependentTaskModel.getRelation());
                        } else {
                            TaskDefinition taskDefinition = taskDefinitionMap.get(dependentItem.getDepTaskCode());
                            if (taskDefinition == null) {
                                log.error("The dependent task's taskDefinition is not exist, dependentItem: {}",
                                        dependentItem);
                                throw new RuntimeException(
                                        "The dependent task's taskDefinition is not exist, dependentItem: "
                                                + dependentItem);
                            }
                            log.info(
                                    "Add dependent task, ProjectName: {}, WorkflowName: {}, WorkflowCode: {}, TaskName: {}, DependentCycle: {}, DependentCycleDate: {}, DependentRelation: {}",
                                    project.getName(), workflowDefinition.getName(), workflowDefinition.getCode(),
                                    taskDefinition.getName(), dependentItem.getCycle(), dependentItem.getDateValue(),
                                    dependentTaskModel.getRelation());
                        }
                    }
                    return new DependentExecute(dependentTaskModel.getDependItemList(),
                            dependentTaskModel.getRelation(), workflowInstance, taskInstance);
                }).collect(Collectors.toList());
        log.info("Initialized dependent task list successfully");
        return dependentExecutes;
    }

    private void initTaskDependentResult() {

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Edit the dependent task in the UI to remove the stale task dependency or point it at the recreated task
  2. Recreate the missing task definition in the referenced workflow
  3. Verify the code in t_ds_task_definition to confirm whether the task exists under a different code

Example fix

// before: depTaskCode 55555 (task deleted)
// after: update dependent item's depTaskCode to the new task's code after re-saving the upstream task
Defensive patterns

Strategy: validation

Validate before calling

if (item.getDepTaskCode() != Constants.DEPENDENT_ALL_TASK_CODE
        && taskDefinitionDao.find_by_code(item.getDepTaskCode()) == null) {
    // dependent task missing — fix dependent item
}

Try / catch

try {
    tracker.initializeDependentTaskList();
} catch (RuntimeException e) {
    if (e.getMessage().contains("taskDefinition is not exist")) {
        taskFailed("Dependent task definition deleted; edit dependent task");
    }
}

Prevention

When it happens

Trigger: A dependent item points to depTaskCode of a task definition that was deleted, or the task was renamed/re-created so its code changed while the dependent item kept the old code.

Common situations: Deleting or recreating a task node that other workflows depend on, restoring workflow definitions without their task definitions, or cross-project dependencies after cleanup scripts.

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