{"record":{"id":"75ade32ddb10e003","repo":"apache/dolphinscheduler","slug":"invalid-code-75ade3","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/InputType.java","lineNumber":70,"sourceCode":"    }\n\n    public String getDescription() {\n        return description;\n    }\n\n    private static final Map<Integer, InputType> VALUES_MAP = new HashMap<>();\n\n    static {\n        for (InputType type : InputType.values()) {\n            VALUES_MAP.put(type.code, type);\n        }\n    }\n\n    public static InputType 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/InputType.java#L52-L73","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Check the inputType value in the data-quality task parameters against InputType's defined codes and fix it.","Reference InputType enum constants instead of raw integers when constructing parameters.","Align parameter producer and data-quality module versions so codes match.","Validate membership in InputType's map before calling of() when input is external."],"exampleFix":"// before\nInputType inputType = InputType.of(params.getInteger(\"inputType\"));\n\n// after: validate then parse\nInteger code = params.getInteger(\"inputType\");\nif (code == null) {\n    throw new IllegalArgumentException(\"inputType is required\");\n}\nInputType inputType = InputType.of(code);","handlingStrategy":"validation","validationCode":"static boolean isKnownInputType(Integer code) {\n    return code != null && Arrays.stream(InputType.values()).anyMatch(t -> t.getCode().equals(code));\n}","typeGuard":"static Optional<InputType> safeOf(Integer status) {\n    if (status == null) return Optional.empty();\n    return Arrays.stream(InputType.values())\n            .filter(t -> t.getCode().equals(status))\n            .findFirst();\n}","tryCatchPattern":"try {\n    inputType = InputType.of(code);\n} catch (IllegalArgumentException e) {\n    throw new IllegalArgumentException(\"inputType \" + code + \" is not a valid data-quality input type\", e);\n}","preventionTips":["Null-check inputType before parsing; of() does not tolerate null keys.","Avoid reusing numeric codes across DataType/OperatorType/InputType.","Generate data-quality params programmatically from the enums to keep codes consistent.","Re-validate imported workflow definitions against the target version's 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"}