apache/dolphinscheduler · error · IllegalArgumentException

invalid code :

Error message

invalid code : 

What it means

CheckType.of(Integer) throws IllegalArgumentException when the given code is not present in the enum's VALUES_MAP. CheckType enumerates data-quality check types (e.g. comparing actual vs expected values) used by the data-quality module; an unmapped code means the check type parameter passed into a data-quality task or API is not a valid enum code.

Source

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

    }

    public String getDescription() {
        return description;
    }

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

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

    public static CheckType 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 checkType value in the data-quality task parameters against the codes defined in CheckType and fix it.
  2. Use CheckType enum constants instead of raw integers when constructing parameters.
  3. If data originated from an older version, remap the stored code to the current CheckType codes.
  4. Guard the call: verify the code is in CheckType's code set before invoking of().

Example fix

// before
CheckType type = CheckType.of(params.getCheckType());

// after: null/validity check first
CheckType type = params.getCheckType() == null ? null : CheckType.of(params.getCheckType());
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

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

Try / catch

try {
    type = CheckType.of(code);
} catch (IllegalArgumentException e) {
    throw new IllegalArgumentException("Unsupported data-quality checkType: " + code + "; valid codes: " +
            Arrays.toString(CheckType.values()), e);
}

Prevention

When it happens

Trigger: Calling CheckType.of() with an Integer absent from VALUES_MAP — typically when the data-quality task params JSON contains an unknown check type, a DB row references a stale code, or a caller confuses CheckType codes with another data-quality enum's codes.

Common situations: Building data-quality job parameters with a mistyped checkType value; upgrading DolphinScheduler data-quality so old parameter codes no longer exist; copying code tables between similar enums (OperatorType/DataType) and passing the wrong integer.

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