{"record":{"id":"ab8ae69b1d112b9d","repo":"apache/dolphinscheduler","slug":"the-task-execution-status-code-s-is-invalid","errorCode":null,"errorMessage":"The task execution status code: %s is invalid","messagePattern":"The task execution status code: (.+?) is invalid","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/ListenerEventType.java","lineNumber":61,"sourceCode":"    static {\n        for (ListenerEventType listenerEventType : ListenerEventType.values()) {\n            CODE_MAP.put(listenerEventType.getCode(), listenerEventType);\n        }\n    }\n\n    @EnumValue\n    private final int code;\n    private final String descp;\n\n    ListenerEventType(int code, String descp) {\n        this.code = code;\n        this.descp = descp;\n    }\n\n    public static ListenerEventType of(int code) {\n        ListenerEventType listenerEventType = CODE_MAP.get(code);\n        if (listenerEventType == null) {\n            throw new IllegalArgumentException(String.format(\"The task execution status code: %s is invalid\",\n                    code));\n        }\n        return listenerEventType;\n    }\n}\n","sourceCodeStart":43,"sourceCodeEnd":67,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/ListenerEventType.java#L43-L67","documentation":"ListenerEventType.of(int) is the code-to-enum converter for workflow/task listener event types. It throws IllegalArgumentException when the given integer is not a registered event type code in CODE_MAP, meaning the payload came from an unknown or incompatible version of DolphinScheduler event types.","triggerScenarios":"Calling ListenerEventType.of(code) with an int that is not one of the enum's defined codes — e.g. deserializing a listener event from a cluster running a newer/older version whose codes differ, or passing a task execution status code by mistake (the message mentions status codes but the enum is event types).","commonSituations":"Event/plugin consumer deserializes MQ/log events across mixed-version clusters; custom plugin passes wrong integer field; enum codes changed after an upgrade so persisted/forwarded codes no longer resolve.","solutions":["Print the offending code and map it to ListenerEventType's defined codes; use the correct code constant from the enum instead of a magic number.","Check version alignment between the event producer and consumer — upgrade or downgrade so both use the same ListenerEventType code set.","Before calling of(), guard with an unknown-code fallback: CODE_MAP keys check or a try/catch that logs and skips unknown events."],"exampleFix":"// before\nListenerEventType type = ListenerEventType.of(rawCode);\n\n// after\nListenerEventType type = Arrays.stream(ListenerEventType.values())\n        .filter(t -> t.getCode() == rawCode)\n        .findFirst()\n        .orElseThrow(() -> new IllegalArgumentException(\n            \"Unsupported listener event code: \" + rawCode + \", known codes: \" +\n            Arrays.toString(ListenerEventType.values())));","handlingStrategy":"try-catch","validationCode":"boolean isValidEventType(int code) {\n    return Arrays.stream(ListenerEventType.values()).anyMatch(t -> t.getCode() == code);\n}","typeGuard":null,"tryCatchPattern":"try {\n    ListenerEventType type = ListenerEventType.of(code);\n    handle(type);\n} catch (IllegalArgumentException e) {\n    log.warn(\"Unknown listener event code {} — skipping (possible version mismatch)\", code, e);\n}","preventionTips":["Use ListenerEventType constants instead of raw integers.","Keep producer and consumer DolphinScheduler versions aligned.","Log unknown codes with the full enum's valid code list for fast diagnosis."],"tags":["enum","deserialization","event-listener","version-mismatch"],"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"}