{"record":{"id":"dbf9e89330340224","repo":"apache/dolphinscheduler","slug":"invalid-code","errorCode":null,"errorMessage":"invalid code : ","messagePattern":"invalid code : ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/enums/dp/CheckType.java","lineNumber":70,"sourceCode":"    }\n\n    public String getDescription() {\n        return description;\n    }\n\n    private static final Map<Integer, CheckType> VALUES_MAP = new HashMap<>();\n\n    static {\n        for (CheckType type : CheckType.values()) {\n            VALUES_MAP.put(type.code, type);\n        }\n    }\n\n    public static CheckType of(Integer status) {\n        if (VALUES_MAP.containsKey(status)) {\n            return VALUES_MAP.get(status);\n        }\n        throw new IllegalArgumentException(\"invalid code : \" + status);\n    }\n}\n","sourceCodeStart":52,"sourceCodeEnd":73,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/enums/dp/CheckType.java#L52-L73","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check the checkType value in the data-quality task parameters against the codes defined in CheckType and fix it.","Use CheckType enum constants instead of raw integers when constructing parameters.","If data originated from an older version, remap the stored code to the current CheckType codes.","Guard the call: verify the code is in CheckType's code set before invoking of()."],"exampleFix":"// before\nCheckType type = CheckType.of(params.getCheckType());\n\n// after: null/validity check first\nCheckType type = params.getCheckType() == null ? null : CheckType.of(params.getCheckType());","handlingStrategy":"validation","validationCode":"static boolean isKnownCheckType(Integer code) {\n    return code != null && Arrays.stream(CheckType.values()).anyMatch(t -> t.getCode().equals(code));\n}","typeGuard":"static Optional<CheckType> safeOf(Integer status) {\n    if (status == null) return Optional.empty();\n    return Arrays.stream(CheckType.values())\n            .filter(t -> t.getCode().equals(status))\n            .findFirst();\n}","tryCatchPattern":"try {\n    type = CheckType.of(code);\n} catch (IllegalArgumentException e) {\n    throw new IllegalArgumentException(\"Unsupported data-quality checkType: \" + code + \"; valid codes: \" +\n            Arrays.toString(CheckType.values()), e);\n}","preventionTips":["Build data-quality parameters from CheckType enum constants, never raw ints.","Null-check the checkType field before calling of().","After DolphinScheduler upgrades, re-validate persisted data-quality parameter codes.","Don't share code tables between CheckType and other data-quality enums."],"tags":["java","enum","data-quality","illegal-argument"],"backgroundTag":"invalid-enum-value","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}