{"record":{"id":"64d148bb736f6713","repo":"apache/dolphinscheduler","slug":"cannot-find-the-task-taskname-in-graph","errorCode":null,"errorMessage":"\"Cannot find the task: \" + taskName + \" in graph\"","messagePattern":"\"Cannot find the task: \" \\+ taskName \\+ \" in graph\"","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/graph/WorkflowExecutionGraph.java","lineNumber":116,"sourceCode":"            }\n        };\n        removeUnReachableEdge.accept(successors);\n        removeUnReachableEdge.accept(predecessors);\n    }\n\n    @Override\n    public List<ITaskExecution> getStartNodes() {\n        return totalTaskExecuteRunnableMap.values()\n                .stream()\n                .filter(taskExecution -> CollectionUtils\n                        .isEmpty(predecessors.get(taskExecution.getName())))\n                .collect(Collectors.toList());\n    }\n\n    @Override\n    public List<ITaskExecution> getPredecessors(final String taskName) {\n        if (!predecessors.containsKey(taskName)) {\n            throw new IllegalArgumentException(\"Cannot find the task: \" + taskName + \" in graph\");\n        }\n        return predecessors\n                .get(taskName)\n                .stream()\n                .map(this::getTaskExecutionByName)\n                .collect(Collectors.toList());\n    }\n\n    @Override\n    public List<ITaskExecution> getSuccessors(final String taskName) {\n        if (!successors.containsKey(taskName)) {\n            throw new IllegalArgumentException(\"Cannot find the task code in graph\");\n        }\n        return successors\n                .get(taskName)\n                .stream()\n                .map(this::getTaskExecutionByName)\n                .collect(Collectors.toList());","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/graph/WorkflowExecutionGraph.java#L98-L134","documentation":"Thrown by WorkflowExecutionGraph.getPredecessors when the requested taskName is not a key in the graph's predecessors map, i.e. the task does not exist in the executing workflow graph. Callers such as isTriggerConditionMet and predecessors rely on every referenced task being registered when the graph was built. This is an internal lookup failure indicating a caller passed a name the graph never contains.","triggerScenarios":"Querying predecessors of a task name absent from the workflow — e.g. isTriggerConditionMet on a task not added during graph construction, or plugin code asking for a task referenced only in params but not present as a DAG node.","commonSituations":"Task renamed between workflow build and lookup; logic-task plugin referencing a dependency by stale name; concurrent workflow modification; calling master-internal graph APIs with names from a different workflow version.","solutions":["Verify the task name exists in the workflow graph before calling getPredecessors (check getTaskExecutionByName or the task list).","Re-fetch/rebuild the workflow execution graph so it reflects the current task definitions.","Fix plugin/task params that reference tasks by old names after renames."],"exampleFix":"// before: unchecked lookup\nList<ITaskExecution> preds = graph.getPredecessors(\"old_task_name\");\n// after: guard first\nif (graph.getTaskExecutionMap().containsKey(\"old_task_name\")) {\n    List<ITaskExecution> preds = graph.getPredecessors(\"old_task_name\");\n}","handlingStrategy":"type-guard","validationCode":"// confirm the task exists in the graph before lookup\nboolean exists = graph.getAllTaskExecutions().stream()\n    .anyMatch(t -> t.getName().equals(taskName));\nif (!exists) return Collections.emptyList(); // or log and skip","typeGuard":"boolean taskInGraph(WorkflowExecutionGraph graph, String name) {\n    return graph.getAllTaskExecutions().stream().anyMatch(t -> t.getName().equals(name));\n}","tryCatchPattern":"try {\n    List<ITaskExecution> preds = graph.getPredecessors(taskName);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Cannot find the task:\")) {\n        preds = Collections.emptyList(); // task absent from this graph version\n    } else throw e;\n}","preventionTips":["Derive task names for graph queries from the graph itself, not stale snapshots.","Avoid hardcoding task names in plugins that walk the DAG.","Re-resolve names after any workflow rename or restructure."],"tags":["workflow","dag","lookup"],"backgroundTag":"record-not-found","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}