{"record":{"id":"69e19cb817fc3659","repo":"apache/dolphinscheduler","slug":"invalid-code-69e19c","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/ExecuteSqlType.java","lineNumber":65,"sourceCode":"    }\n\n    public String getDescription() {\n        return description;\n    }\n\n    private static final Map<Integer, ExecuteSqlType> VALUES_MAP = new HashMap<>();\n\n    static {\n        for (ExecuteSqlType type : ExecuteSqlType.values()) {\n            VALUES_MAP.put(type.code, type);\n        }\n    }\n\n    public static ExecuteSqlType 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":47,"sourceCodeEnd":68,"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/ExecuteSqlType.java#L47-L68","documentation":"ExecuteSqlType.of(Integer) throws IllegalArgumentException when the given code is not in VALUES_MAP. ExecuteSqlType classifies SQL statements in a data-quality task (e.g. the check/compare SQL vs output SQL); an unmapped code means a sql type parameter supplied to the data-quality engine is not recognized.","triggerScenarios":"Calling ExecuteSqlType.of() with an Integer absent from VALUES_MAP — e.g. data-quality task parameters list SQL statements whose type field is 0/-1 or some code from another enum, or stored parameters reference removed type codes after an upgrade.","commonSituations":"Programmatically generating data-quality SQL parameter lists with a wrong type index; editing workflow JSON by hand; version skew between the API that writes parameters and the data-quality module that reads them.","solutions":["Verify each sqlType value in the data-quality task parameters matches an ExecuteSqlType constant and correct it.","Use ExecuteSqlType enum constants when building parameter JSON.","Remap legacy codes if parameters were persisted by an older DolphinScheduler version.","Catch IllegalArgumentException around parsing and surface which sqlType value was invalid."],"exampleFix":"// before\nExecuteSqlType sqlType = ExecuteSqlType.of(entry.getInt(\"sqlType\"));\n\n// after: default for unknown values\nint code = entry.getInt(\"sqlType\", -1);\nExecuteSqlType sqlType = code < 0 ? ExecuteSqlType.DEFAULT : ExecuteSqlType.of(code);","handlingStrategy":"validation","validationCode":"static boolean isKnownSqlType(Integer code) {\n    return code != null && Arrays.stream(ExecuteSqlType.values()).anyMatch(t -> t.getCode().equals(code));\n}","typeGuard":"static Optional<ExecuteSqlType> safeOf(Integer status) {\n    if (status == null) return Optional.empty();\n    return Arrays.stream(ExecuteSqlType.values())\n            .filter(t -> t.getCode().equals(status))\n            .findFirst();\n}","tryCatchPattern":"try {\n    sqlType = ExecuteSqlType.of(code);\n} catch (IllegalArgumentException e) {\n    log.warn(\"Bad sqlType {} in data-quality params, skipping statement\", code);\n    sqlType = null;\n}","preventionTips":["Generate SQL parameter lists using ExecuteSqlType constants, not loop indices.","Validate every sqlType entry when loading data-quality task parameters.","Version-check exported workflow JSON before importing into another DolphinScheduler release.","Include the offending code value in error logs to ease diagnosis."],"tags":["java","enum","data-quality","sql"],"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-14T05:17:10.506Z"}