apache/dolphinscheduler · error · IllegalArgumentException

"Unsupported task depend type: " + taskDependType

Error message

"Unsupported task depend type: " + taskDependType

What it means

WorkflowGraphTopologyLogicalVisitor visits a workflow DAG filtered by TaskDependType (TASK_PRE, TASK_POST, etc.). The visitor's visit() switch has no branch for the given taskDependType, so the default arm throws this IllegalArgumentException. It means the depend type is not one of the supported enum values for topology visiting.

Source

Thrown at dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/graph/WorkflowGraphTopologyLogicalVisitor.java:74

    }

    public static WorkflowGraphBfsVisitorBuilder builder() {
        return new WorkflowGraphBfsVisitorBuilder();
    }

    public void visit() {
        switch (taskDependType) {
            case TASK_ONLY:
                visitStartNodesOnly();
                break;
            case TASK_PRE:
                visitToStartNodes();
                break;
            case TASK_POST:
                visitFromStartNodes();
                break;
            default:
                throw new IllegalArgumentException("Unsupported task depend type: " + taskDependType);
        }
    }

    /**
     * Visit start nodes only.
     */
    private void visitStartNodesOnly() {
        doVisitationInSubGraph(Sets.newHashSet(startNodes));
    }

    /**
     * Find the graph nodes that can be reached to the start nodes, and then do visitation with topology logical.
     */
    private void visitToStartNodes() {
        final LinkedList<String> bootstrapTaskCodes = new LinkedList<>(startNodes);
        final Set<String> subGraphNodes = new HashSet<>();
        while (!bootstrapTaskCodes.isEmpty()) {
            String taskName = bootstrapTaskCodes.removeFirst();

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Only call visit() with TaskDependType.TASK_PRE or TaskDependType.TASK_POST
  2. Add a case for the missing TaskDependType in WorkflowGraphTopologyLogicalVisitor.visit() if the new type should be supported
  3. Verify the enum value's origin (API payload, DB column) — map legacy/unknown values to a supported type before visiting
  4. Catch IllegalArgumentException and skip/log unsupported depend types when scanning mixed-version data

Example fix

// before
switch (taskDependType) {
    case TASK_PRE: visitToStartNodes(); break;
    case TASK_POST: visitFromStartNodes(); break;
    default: throw new IllegalArgumentException(...);
}
// after
switch (taskDependType) {
    case TASK_PRE: visitToStartNodes(); break;
    case TASK_POST: visitFromStartNodes(); break;
    case ALL_TASKS: visitToStartNodes(); visitFromStartNodes(); break;
    default: throw new IllegalArgumentException("Unsupported task depend type: " + taskDependType);
}
Defensive patterns

Strategy: validation

Validate before calling

if (taskDependType != TaskDependType.TASK_PRE && taskDependType != TaskDependType.TASK_POST) {
    throw new IllegalStateException("Depend type not supported by topology visitor: " + taskDependType);
}

Type guard

boolean isVisitable(TaskDependType t) {
    return t == TaskDependType.TASK_PRE || t == TaskDependType.TASK_POST;
}

Try / catch

try {
    visitor.visit();
} catch (IllegalArgumentException e) {
    if (e.getMessage().startsWith("Unsupported task depend type")) {
        log.warn("Skipping unsupported depend type", e);
        return;
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling visit() with a TaskDependType value outside TASK_PRE/TASK_POST — either a null/unknown enum value or a newly added enum constant that the visitor has not been updated to handle (e.g. ALL_TASKS / CONDITION branches not implemented here).

Common situations: Adding a new TaskDependType enum constant without updating this visitor's switch; deserializing a depend type from an older/newer version's data that maps to an unhandled constant; passing a raw/default enum value by mistake in custom master-engine extensions.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06). Data as JSON: /api/errors/2f3452c25848d0cb. Report an issue: GitHub.