apache/dolphinscheduler · error · IllegalArgumentException

invalid status : <status>

Error message

invalid status : <status>

What it means

TaskGroupQueueStatus.of(int) converts a numeric status code into the TaskGroupQueueStatus enum used by the task-group queue feature. It throws IllegalArgumentException when the status integer is absent from STATUS_MAP, i.e. an unrecognized queue status was supplied.

Source

Thrown at dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/TaskGroupQueueStatus.java:54

    private final String descp;
    private static HashMap<Integer, TaskGroupQueueStatus> STATUS_MAP = new HashMap<>();

    static {
        for (TaskGroupQueueStatus taskGroupQueueStatus : TaskGroupQueueStatus.values()) {
            STATUS_MAP.put(taskGroupQueueStatus.code, taskGroupQueueStatus);
        }
    }

    TaskGroupQueueStatus(int code, String descp) {
        this.code = code;
        this.descp = descp;
    }

    public static TaskGroupQueueStatus of(int status) {
        if (STATUS_MAP.containsKey(status)) {
            return STATUS_MAP.get(status);
        }
        throw new IllegalArgumentException("invalid status : " + status);
    }

    public int getCode() {
        return code;
    }

    public String getDescp() {
        return descp;
    }
}

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Inspect the offending status integer and compare with the enum's defined codes; use the enum's constants rather than raw numbers.
  2. Fix or migrate the task_group_queue rows that carry unknown status values.
  3. Guard the conversion with a try/catch or STATUS_MAP-style contains check and treat unknown statuses as pending or log-and-skip.

Example fix

// before
TaskGroupQueueStatus st = TaskGroupQueueStatus.of(row.getStatus());

// after
TaskGroupQueueStatus st = Arrays.stream(TaskGroupQueueStatus.values())
        .filter(s -> s.getCode() == row.getStatus())
        .findFirst()
        .orElse(TaskGroupQueueStatus.WAITING_QUEUE); // or throw with clearer context
Defensive patterns

Strategy: try-catch

Validate before calling

boolean isValidGroupQueueStatus(int status) {
    return Arrays.stream(TaskGroupQueueStatus.values()).anyMatch(s -> s.getCode() == status);
}

Try / catch

try {
    TaskGroupQueueStatus status = TaskGroupQueueStatus.of(code);
    render(status);
} catch (IllegalArgumentException e) {
    log.warn("Unknown task group queue status {} — defaulting display", code);
}

Prevention

When it happens

Trigger: Calling TaskGroupQueueStatus.of(status) with an int that is not one of the enum's defined codes — e.g. reading a task_group_queue row whose status column holds an unknown value, or passing an unrelated status code.

Common situations: DB data written by a version with different status codes; custom SQL/scripts insert arbitrary status values; consumer code passes TaskExecutionStatus codes instead of TaskGroupQueueStatus codes.

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