{"record":{"id":"397d3d462b190451","repo":"apache/incubator-seata","slug":"unknown-magic-code-b0-b1","errorCode":null,"errorMessage":"Unknown magic code: {b0}, {b1}","messagePattern":"Unknown magic code: (.+?), (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/seata/core/rpc/netty/MultiProtocolDecoder.java","lineNumber":174,"sourceCode":"                    }\n                    ctx.pipeline().remove(this);\n                }\n            }\n        } catch (Exception exx) {\n            LOGGER.error(\"Decode frame error, cause: {}\", exx.getMessage());\n            throw new DecodeException(exx);\n        }\n        return decoded;\n    }\n\n    protected byte decideVersion(Object in) {\n        if (in instanceof ByteBuf) {\n            ByteBuf frame = (ByteBuf) in;\n            frame.markReaderIndex();\n            byte b0 = frame.readByte();\n            byte b1 = frame.readByte();\n            if (ProtocolConstants.MAGIC_CODE_BYTES[0] != b0 || ProtocolConstants.MAGIC_CODE_BYTES[1] != b1) {\n                throw new IllegalArgumentException(\"Unknown magic code: \" + b0 + \", \" + b1);\n            }\n\n            byte version = frame.readByte();\n            frame.resetReaderIndex();\n            return version;\n        }\n        return -1;\n    }\n\n    protected boolean isV0(ByteBuf in) {\n        boolean isV0 = false;\n        in.markReaderIndex();\n        byte b0 = in.readByte();\n        byte b1 = in.readByte();\n        // v1/v2/v3 : b2 = version\n        // v0 : 1st byte in FLAG(2byte:0x10/0x20/0x40/0x80)\n        byte b2 = in.readByte();\n        if (ProtocolConstants.MAGIC_CODE_BYTES[0] == b0 && ProtocolConstants.MAGIC_CODE_BYTES[1] == b1 && 0 == b2) {","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/apache/incubator-seata/blob/e01f97c6db397165050caa6764020410c2c8199a/core/src/main/java/org/apache/seata/core/rpc/netty/MultiProtocolDecoder.java#L156-L192","documentation":"IllegalArgumentException from MultiProtocolDecoder.decideVersion: the first two bytes of an inbound frame do not equal Seata's magic code bytes. The magic code is a fixed frame signature; a mismatch means the bytes arriving on this port are not a Seata RPC frame at all (or are corrupted/encrypted/rewritten in transit).","triggerScenarios":"Any non-Seata traffic reaching the seata server/client port (HTTP health checks, monitoring probes, port scanners, another protocol); TLS enabled on one side only so ciphertext is parsed as plaintext; a proxy or LB that mangles the stream.","commonSituations":"Kubernetes readiness/liveness probes pointed at the transaction port instead of the console port; aLoadBalancer TCP health check sending an HTTP HEAD; SSL misconfiguration; pointing the client at the wrong service/port in the registry.","solutions":["Check what is connecting: find the source of the frames (probe config, scanner, wrong client address)","Point health probes at the seata console/http port, not the RPC listen port","Ensure TLS/SSL settings match on both ends (both plaintext or both TLS)","Verify the registry advertises the correct RPC port of the seata-server"],"exampleFix":"# before: k8s probe hits the RPC port\nlivenessProbe:\n  tcpSocket: { port: 8091 }  # seata RPC port\n\n# after: probe the console port\nlivenessProbe:\n  httpGet: { path: /, port: 7091 }","handlingStrategy":"validation","validationCode":"// sanity: ensure the configured endpoint is a seata RPC endpoint before connect\n// e.g. verify registry advertises the seata-server netty port (default 8091), not console 7091","typeGuard":null,"tryCatchPattern":"catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Unknown magic code\")) {\n        // wrong endpoint/protocol: stop pointing non-seata traffic at this port\n    }\n}","preventionTips":["Point health probes at the console/HTTP port, never the RPC port","Keep TLS settings symmetric on client and server","Document which port is RPC vs console in deployment configs"],"tags":["protocol","magic-code","misrouting","netty"],"backgroundTag":null,"analyzedSha":"e01f97c6db397165050caa6764020410c2c8199a","analyzedAt":"2026-08-14T10:23:53.097Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}