{"record":{"id":"f656421976a59458","repo":"apache/incubator-seata","slug":"unknown-resultcode-ordinal","errorCode":null,"errorMessage":"Unknown ResultCode[{ordinal}]","messagePattern":"Unknown ResultCode\\[(.+?)\\]","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/seata/core/protocol/ResultCode.java","lineNumber":59,"sourceCode":"     * @return the result code\n     */\n    public static ResultCode get(byte ordinal) {\n        return get((int) ordinal);\n    }\n\n    /**\n     * Get result code.\n     *\n     * @param ordinal the ordinal\n     * @return the result code\n     */\n    public static ResultCode get(int ordinal) {\n        for (ResultCode resultCode : ResultCode.values()) {\n            if (resultCode.ordinal() == ordinal) {\n                return resultCode;\n            }\n        }\n        throw new IllegalArgumentException(\"Unknown ResultCode[\" + ordinal + \"]\");\n    }\n}\n","sourceCodeStart":41,"sourceCodeEnd":62,"githubUrl":"https://github.com/apache/incubator-seata/blob/e01f97c6db397165050caa6764020410c2c8199a/core/src/main/java/org/apache/seata/core/protocol/ResultCode.java#L41-L62","documentation":"ResultCode.get(int) maps the numeric result code from an RPC response message to the ResultCode enum (Success/Failed). It throws when the ordinal is outside the enum range, i.e. the decoded integer cannot be a result code known to this build.","triggerScenarios":"Decoding a response whose result-code field holds a value beyond the enum — version skew where a peer uses an extended enum, or a corrupted frame misread during deserialization.","commonSituations":"Mixed Seata versions across client/server, byte-stream corruption from a middlebox, or a non-Seata protocol hitting the same port.","solutions":["Upgrade the older side so both ends share the same protocol enum set.","Keep client<->TC traffic direct TCP; remove proxies that can alter framing.","Log the raw RpcMessage (type, id, body length) at the decoder to distinguish skew from corruption."],"exampleFix":"# before\nclient 1.x decoding responses from server 2.x\n# after\nclient upgraded to the same seata version as the server","handlingStrategy":"type-guard","validationCode":"static boolean validResultCode(int o) {\n    for (ResultCode r : ResultCode.values()) if (r.ordinal() == o) return true;\n    return false;\n}","typeGuard":"static Optional<ResultCode> safeResult(int o) {\n    return Arrays.stream(ResultCode.values()).filter(r -> r.ordinal() == o).findFirst();\n}","tryCatchPattern":"catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Unknown ResultCode\")) { LOG.warn(\"result code {} unknown on this build — check version skew\", o); }\n    else throw e;\n}","preventionTips":["Run identical Seata versions client/server","Include version in heartbeat logging for skew detection"],"tags":["protocol","enum","decode","version-mismatch"],"backgroundTag":null,"analyzedSha":"e01f97c6db397165050caa6764020410c2c8199a","analyzedAt":"2026-08-14T10:23:53.097Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}