apache/dolphinscheduler · error · IllegalArgumentException

invalid status :

Error message

invalid status : 

What it means

TaskTimeoutStrategy.of(status) throws IllegalArgumentException when the supplied integer does not match any timeout strategy code. TaskTimeoutStrategy enumerates how a task timeout is handled (e.g. WARN, FAILED, WARNFAILED); an unmapped code indicates a bad configuration value or wrong enum being consulted.

Source

Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/enums/TaskTimeoutStrategy.java:56

    @EnumValue
    private final int code;
    private final String descp;

    public int getCode() {
        return code;
    }

    public String getDescp() {
        return descp;
    }

    public static TaskTimeoutStrategy of(int status) {
        for (TaskTimeoutStrategy es : values()) {
            if (es.getCode() == status) {
                return es;
            }
        }
        throw new IllegalArgumentException("invalid status : " + status);
    }

}

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Use only documented values (WARN=0, FAILED=1, WARNFAILED=3) in task parameters and API payloads.
  2. Check the source of the bad integer — the timeout strategy field in the task definition JSON or DB — and correct it to a valid code.
  3. Prefer passing the enum constant (TaskTimeoutStrategy.FAILED) instead of raw ints in internal code.
  4. Catch IllegalArgumentException when parsing user-supplied values and fall back to a default strategy.

Example fix

// before
TaskTimeoutStrategy strategy = TaskTimeoutStrategy.of(userInput);

// after: validate before parsing
int code = Integer.parseInt(userInput);
if (code != 0 && code != 1 && code != 3) {
    throw new IllegalArgumentException("timeout strategy must be 0, 1 or 3: " + code);
}
TaskTimeoutStrategy strategy = TaskTimeoutStrategy.of(code);
Defensive patterns

Strategy: validation

Validate before calling

static boolean isValidTimeoutStrategy(int code) {
    return code == 0 || code == 1 || code == 3; // WARN, FAILED, WARNFAILED
}

Type guard

static Optional<TaskTimeoutStrategy> safeOf(int status) {
    return Arrays.stream(TaskTimeoutStrategy.values())
            .filter(es -> es.getCode() == status)
            .findFirst();
}

Try / catch

try {
    strategy = TaskTimeoutStrategy.of(rawCode);
} catch (IllegalArgumentException e) {
    log.warn("Invalid timeout strategy {}, falling back to FAILED", rawCode);
    strategy = TaskTimeoutStrategy.FAILED;
}

Prevention

When it happens

Trigger: Calling of() with an int not equal to 0 (WARN), 1 (FAILED) or 3 (WARNFAILED) — typically when parsing the timeout strategy field from task params JSON, the workflow definition DB, or an API request that supplies an out-of-range or legacy value.

Common situations: Hand-edited task JSON with a wrong timeout strategy value; importing workflow definitions exported from a different DolphinScheduler version with different enum codes; API callers sending 2 or other invalid codes; confusing TaskTimeoutStrategy codes with TaskExecuteTimeoutStrategy or other enums.

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