apache/incubator-seata · error · IllegalArgumentException
unknown codec:{name}
Error message
unknown codec:{name} What it means
Thrown by CompressorType.getByName(String) when the configured compression name does not match any CompressorType enum (case-insensitive). This runs at configuration-load time when transport.compression / serializer compression is resolved from name to enum.
Source
Thrown at core/src/main/java/org/apache/seata/core/compressor/CompressorType.java:94
return b;
}
}
throw new IllegalArgumentException("unknown codec:" + code);
}
/**
* Gets result code.
*
* @param name the code
* @return the result code
*/
public static CompressorType getByName(String name) {
for (CompressorType b : CompressorType.values()) {
if (b.name().equalsIgnoreCase(name)) {
return b;
}
}
throw new IllegalArgumentException("unknown codec:" + name);
}
/**
* Gets code.
*
* @return the code
*/
public byte getCode() {
return code;
}
}
View on GitHub (pinned to e01f97c6db)
Solutions
- Correct the name to one of the enum values, e.g. transport.compression = gzip (exact spelling, no whitespace).
- List supported names for your Seata version (CompressorType.values()) before choosing; pick NONE to disable.
- After fixing, restart the application — this is resolved at startup.
Example fix
# before transport.compression = gizp # after transport.compression = gzip
Defensive patterns
Strategy: validation
Validate before calling
static boolean validCompressorName(String name) {
return Arrays.stream(CompressorType.values()).anyMatch(t -> t.name().equalsIgnoreCase(name.trim()));
} Type guard
static Optional<CompressorType> safeByName(String name) {
String n = name == null ? "" : name.trim();
return Arrays.stream(CompressorType.values()).filter(t -> t.name().equalsIgnoreCase(n)).findFirst();
} Prevention
- Validate config keys in CI with a config-linter against the enum sets
- Trim whitespace in yaml values
- Fail startup fast on unknown names rather than discovering at runtime
When it happens
Trigger: Setting transport.compression (client) or transport.compression on the server to a typo or unsupported value: 'gizp', 'gzip ' with whitespace, 'snappy', 'lz4' on a build that lacks the lz4 dependency.
Common situations: Hand-edited file.conf/yaml with a misspelled codec name; copy-pasted config from a different Seata version that supported a different codec set; codec requiring an optional dependency (e.g. sevenz/bzip2) not on the classpath is still a name-miss if enum absent.
Related errors
- ERR_CONFIG
- Apollo configuration initialized failed,please check the val
- config type can not be null
- file not found
- not support config data type type: %s
AI-assisted analysis of apache/incubator-seata@e01f97c6db (2026-08-14).
Data as JSON: /api/errors/2f7ac6fffe2e8f6e.
Report an issue: GitHub.