{"record":{"id":"27c995ee215e3e6c","repo":"apache/cassandra","slug":"snappy-compression-is-not-supported-in-protocol-v5","errorCode":null,"errorMessage":"Snappy compression is not supported in protocol V5","messagePattern":"Snappy compression is not supported in protocol V5","errorType":"exception","errorClass":"ProtocolException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/transport/messages/StartupMessage.java","lineNumber":109,"sourceCode":"        {\n            if (new CassandraVersion(cqlVersion).compareTo(new CassandraVersion(\"2.99.0\")) < 0)\n                throw new ProtocolException(String.format(\"CQL version %s is not supported by the binary protocol (supported version are >= 3.0.0)\", cqlVersion));\n        }\n        catch (IllegalArgumentException e)\n        {\n            throw new ProtocolException(e.getMessage());\n        }\n\n        if (options.containsKey(COMPRESSION))\n        {\n            String compression = toLowerCaseLocalized(options.get(COMPRESSION));\n            if (compression.equals(\"snappy\"))\n            {\n                if (Compressor.SnappyCompressor.instance == null)\n                    throw new ProtocolException(\"This instance does not support Snappy compression\");\n\n                if (getSource().header.version.isGreaterOrEqualTo(ProtocolVersion.V5))\n                    throw new ProtocolException(\"Snappy compression is not supported in protocol V5\");\n\n                connection.setCompressor(Compressor.SnappyCompressor.instance);\n            }\n            else if (compression.equals(\"lz4\"))\n            {\n                connection.setCompressor(Compressor.LZ4Compressor.instance);\n            }\n            else\n            {\n                throw new ProtocolException(String.format(\"Unknown compression algorithm: %s\", compression));\n            }\n        }\n\n        connection.setThrowOnOverload(\"1\".equals(options.get(THROW_ON_OVERLOAD)));\n\n        ClientState clientState = state.getClientState();\n        clientState.setClientOptions(options);\n        String driverName = options.get(DRIVER_NAME);","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/transport/messages/StartupMessage.java#L91-L127","documentation":"Starting with native protocol V5, Cassandra no longer allows Snappy compression; only lz4 is supported. If a client negotiates protocol V5 (or higher) and sends STARTUP with COMPRESSION=snappy, this ProtocolException is thrown and the connection is rejected.","triggerScenarios":"Client driver configured with snappy compression AND connecting with native protocol version >= V5 (default in recent drivers connecting to Cassandra 4+).","commonSituations":"Upgrading Cassandra to 4.x+ where V5 is the default protocol version while the driver still has legacy snappy compression configured; driver version pinned to V5+ against a snappy-configured client; mixed fleet where older nodes accepted snappy on V4 but newer ones reject it.","solutions":["Switch the client driver's compression to lz4","Force the driver to use protocol V4 if Snappy must be kept (set protocol version explicitly in the driver config)","Upgrade driver settings to the recommended lz4 compression for Cassandra 4+"],"exampleFix":"// before (driver config)\ncompression: 'snappy'\n// after\ncompression: 'lz4'","handlingStrategy":"validation","validationCode":"// Only set snappy when the cluster supports protocol V4\nif (serverProtocolVersion < ProtocolVersion.V5) cluster.compression = 'snappy'; else cluster.compression = 'lz4';","typeGuard":null,"tryCatchPattern":"catch (protocol errors on connect) and retry with lz4 compression","preventionTips":["Use lz4 for all Cassandra 4+ clients","Do not pin snappy in driver configs when protocol V5+ is negotiated","Check driver protocol version defaults after upgrades"],"tags":["protocol","compression","v5","client-connection"],"backgroundTag":"unsupported-operation","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}