{"record":{"id":"4beab7cec129bc79","repo":"apache/incubator-seata","slug":"unknown-codec-code","errorCode":null,"errorMessage":"unknown codec:{code}","messagePattern":"unknown codec:(.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/seata/core/compressor/CompressorType.java","lineNumber":79,"sourceCode":"    private final byte code;\n\n    CompressorType(final byte code) {\n        this.code = code;\n    }\n\n    /**\n     * Gets result code.\n     *\n     * @param code the code\n     * @return the result code\n     */\n    public static CompressorType getByCode(int code) {\n        for (CompressorType b : CompressorType.values()) {\n            if (code == b.code) {\n                return b;\n            }\n        }\n        throw new IllegalArgumentException(\"unknown codec:\" + code);\n    }\n\n    /**\n     * Gets result code.\n     *\n     * @param name the code\n     * @return the result code\n     */\n    public static CompressorType getByName(String name) {\n        for (CompressorType b : CompressorType.values()) {\n            if (b.name().equalsIgnoreCase(name)) {\n                return b;\n            }\n        }\n        throw new IllegalArgumentException(\"unknown codec:\" + name);\n    }\n\n    /**","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/apache/incubator-seata/blob/e01f97c6db397165050caa6764020410c2c8199a/core/src/main/java/org/apache/seata/core/compressor/CompressorType.java#L61-L97","documentation":"Thrown by CompressorType.getByCode(int) when decoding a protocol header whose compression code byte does not match any CompressorType enum (NONE, GZIP, ...). RPC messages carry a compressor code; the receiving side maps it back to an enum and fails on unknown values.","triggerScenarios":"A peer sends RpcMessage headers with a compressor code outside the known set — typically a newer Seata version that added a codec (e.g. zstd) talking to an older version that lacks it, or corrupted/garbage bytes parsed as a header.","commonSituations":"Rolling upgrade where client and server run different Seata versions and compression is enabled (transport.compression), a non-Seata service connecting to the TC port, or byte-level protocol corruption from a misbehaving proxy.","solutions":["Align seata versions (client, TM, RM, TC server) across the deployment; compression codes are version-dependent.","Check transport.compression settings on both ends: disable compression or set it to a codec both sides support.","If unexplained, capture the raw payload — a non-Seata client or proxy mangling frames can produce bogus header bytes."],"exampleFix":"# before: mixed versions with compression on\nclient: seata 2.1 with transport.compression=zstd\nserver: seata 1.6\n# after\nboth ends: seata 2.x, transport.compression=gzip (or none)","handlingStrategy":"type-guard","validationCode":"static boolean isKnownCompressorCode(int code) {\n    for (CompressorType t : CompressorType.values()) if (t.getCode() == code) return true;\n    return false;\n}","typeGuard":"static Optional<CompressorType> safeByCode(int code) {\n    return Arrays.stream(CompressorType.values()).filter(t -> t.getCode() == code).findFirst();\n}","tryCatchPattern":"catch (IllegalArgumentException e) {\n    // unknown wire code => version skew or corruption; drop connection, do not guess a default codec\n    channel.close();\n    LOG.warn(\"unsupported compressor code {} from peer; requires version alignment\", code);\n}","preventionTips":["Pin one Seata version across the fleet","Prefer compression=NONE unless all nodes support the codec","Reject unknown header fields loudly instead of defaulting"],"tags":["protocol","compression","version-mismatch","config"],"backgroundTag":null,"analyzedSha":"e01f97c6db397165050caa6764020410c2c8199a","analyzedAt":"2026-08-14T10:23:53.097Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}