apache/incubator-seata · error · IllegalArgumentException
Unknown ResultCode[{ordinal}]
Error message
Unknown ResultCode[{ordinal}] What it means
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.
Source
Thrown at core/src/main/java/org/apache/seata/core/protocol/ResultCode.java:59
* @return the result code
*/
public static ResultCode get(byte ordinal) {
return get((int) ordinal);
}
/**
* Get result code.
*
* @param ordinal the ordinal
* @return the result code
*/
public static ResultCode get(int ordinal) {
for (ResultCode resultCode : ResultCode.values()) {
if (resultCode.ordinal() == ordinal) {
return resultCode;
}
}
throw new IllegalArgumentException("Unknown ResultCode[" + ordinal + "]");
}
}
View on GitHub (pinned to e01f97c6db)
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.
Example fix
# before client 1.x decoding responses from server 2.x # after client upgraded to the same seata version as the server
Defensive patterns
Strategy: type-guard
Validate before calling
static boolean validResultCode(int o) {
for (ResultCode r : ResultCode.values()) if (r.ordinal() == o) return true;
return false;
} Type guard
static Optional<ResultCode> safeResult(int o) {
return Arrays.stream(ResultCode.values()).filter(r -> r.ordinal() == o).findFirst();
} Try / catch
catch (IllegalArgumentException e) {
if (e.getMessage().startsWith("Unknown ResultCode")) { LOG.warn("result code {} unknown on this build — check version skew", o); }
else throw e;
} Prevention
- Run identical Seata versions client/server
- Include version in heartbeat logging for skew detection
When it happens
Trigger: 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.
Common situations: Mixed Seata versions across client/server, byte-stream corruption from a middlebox, or a non-Seata protocol hitting the same port.
Related errors
- Unknown TransactionExceptionCode[{ordinal}]
- Unknown ClientType[{ordinal}]
- Unknown GlobalStatus[{code}]
- Unknown BranchType[{ordinal}]
- Invalid event format: expected prefix '{}', got: {}
AI-assisted analysis of apache/incubator-seata@e01f97c6db (2026-08-14).
Data as JSON: /api/errors/f656421976a59458.
Report an issue: GitHub.