apache/dolphinscheduler · error · IllegalArgumentException

invalid code :

Error message

invalid code : 

What it means

InputType.of(Integer) throws IllegalArgumentException when the given code is not a key of VALUES_MAP. InputType enumerates how data-quality inputs are provided (e.g. realtime vs offline source parameters); an unmapped code means the input type in data-quality task parameters is not defined in this build.

Source

Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/enums/dp/InputType.java:70

    }

    public String getDescription() {
        return description;
    }

    private static final Map<Integer, InputType> VALUES_MAP = new HashMap<>();

    static {
        for (InputType type : InputType.values()) {
            VALUES_MAP.put(type.code, type);
        }
    }

    public static InputType of(Integer status) {
        if (VALUES_MAP.containsKey(status)) {
            return VALUES_MAP.get(status);
        }
        throw new IllegalArgumentException("invalid code : " + status);
    }
}

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Check the inputType value in the data-quality task parameters against InputType's defined codes and fix it.
  2. Reference InputType enum constants instead of raw integers when constructing parameters.
  3. Align parameter producer and data-quality module versions so codes match.
  4. Validate membership in InputType's map before calling of() when input is external.

Example fix

// before
InputType inputType = InputType.of(params.getInteger("inputType"));

// after: validate then parse
Integer code = params.getInteger("inputType");
if (code == null) {
    throw new IllegalArgumentException("inputType is required");
}
InputType inputType = InputType.of(code);
Defensive patterns

Strategy: validation

Validate before calling

static boolean isKnownInputType(Integer code) {
    return code != null && Arrays.stream(InputType.values()).anyMatch(t -> t.getCode().equals(code));
}

Type guard

static Optional<InputType> safeOf(Integer status) {
    if (status == null) return Optional.empty();
    return Arrays.stream(InputType.values())
            .filter(t -> t.getCode().equals(status))
            .findFirst();
}

Try / catch

try {
    inputType = InputType.of(code);
} catch (IllegalArgumentException e) {
    throw new IllegalArgumentException("inputType " + code + " is not a valid data-quality input type", e);
}

Prevention

When it happens

Trigger: Calling InputType.of() with an Integer missing from VALUES_MAP — typically when the data-quality task params JSON carries an unknown inputType, or a caller reuses codes from a sibling enum (DataType, OperatorType).

Common situations: Hand-built data-quality parameter templates; API clients sending wrong numeric input types; workflow definitions persisted by a different DolphinScheduler version with divergent InputType 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/75ade32ddb10e003. Report an issue: GitHub.