{"record":{"id":"c9a3ab3bcb353924","repo":"apache/cassandra","slug":"invalid-compressor-type-s-specified-for-lz4-par","errorCode":null,"errorMessage":"Invalid compressor type '%s' specified for LZ4 parameter '%s'. Valid options are %s.","messagePattern":"Invalid compressor type '(.+?)' specified for LZ4 parameter '(.+?)'\\. Valid options are (.+?)\\.","errorType":"validation","errorClass":"org.apache.cassandra.exceptions.ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/io/compress/LZ4Compressor.java","lineNumber":206,"sourceCode":"        if (input.remaining() > 0)\n        {\n            throw new IOException(\"Compressed lengths mismatch - \"+input.remaining()+\" bytes remain\");\n        }\n    }\n\n    public Set<String> supportedOptions()\n    {\n        return new HashSet<>(Arrays.asList(LZ4_HIGH_COMPRESSION_LEVEL, LZ4_COMPRESSOR_TYPE));\n    }\n\n    public static String validateCompressorType(String compressorType) throws ConfigurationException\n    {\n        if (compressorType == null)\n            return DEFAULT_LZ4_COMPRESSOR_TYPE;\n\n        if (!VALID_COMPRESSOR_TYPES.contains(compressorType))\n        {\n            throw new ConfigurationException(String.format(\"Invalid compressor type '%s' specified for LZ4 parameter '%s'. \"\n                                                           + \"Valid options are %s.\", compressorType, LZ4_COMPRESSOR_TYPE,\n                                                           VALID_COMPRESSOR_TYPES.toString()));\n        }\n        else\n        {\n            return compressorType;\n        }\n    }\n\n    public static Integer validateCompressionLevel(String compressionLevel) throws ConfigurationException\n    {\n        if (compressionLevel == null)\n            return DEFAULT_HIGH_COMPRESSION_LEVEL;\n\n        ConfigurationException ex = new ConfigurationException(\"Invalid value [\" + compressionLevel + \"] for parameter '\"\n                                                                 + LZ4_HIGH_COMPRESSION_LEVEL + \"'. Value must be between 1 and 17.\");\n\n        Integer level;","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/io/compress/LZ4Compressor.java#L188-L224","documentation":"LZ4Compressor accepts a 'type' option choosing between the fast (LZ4Factory) and high-compression (LZ4 HC) implementations. validateCompressorType checks the supplied value against the known set; any other string is rejected with a ConfigurationException listing the valid options. This runs at schema/compression-option parsing time, typically when creating or altering a table.","triggerScenarios":"Executing CREATE/ALTER TABLE with compression = {'class': 'LZ4Compressor', 'type': '<something>'} where <something> is not one of the valid compressor type strings (e.g. a typo like 'hzigh' instead of 'high').","commonSituations":"Typo in CQL compression options; copying options from documentation of a different Cassandra version where valid values differ; tools generating CQL with an unsupported enum string.","solutions":["Use one of the valid values reported in the error message (e.g. 'fast' or 'high') for the 'type' option.","Check the documentation for your Cassandra version's supported LZ4 'type' values and correct the CQL statement.","If the value comes from a provisioning tool or ORM config, fix the template that emits the compression option."],"exampleFix":"// before\nCREATE TABLE t (...) WITH compression = {'class':'LZ4Compressor','type':'hzigh'};\n// after\nCREATE TABLE t (...) WITH compression = {'class':'LZ4Compressor','type':'high'};","handlingStrategy":"validation","validationCode":"Set<String> valid = Set.of(\"fast\", \"high\");\nif (type != null && !valid.contains(type)) throw new IllegalArgumentException(\"Invalid LZ4 type: \" + type);","typeGuard":null,"tryCatchPattern":"try {\n    session.execute(\"CREATE TABLE t (...) WITH compression = {'class':'LZ4Compressor','type':'?'}\", type);\n} catch (ConfigurationException e) {\n    // fall back to default LZ4 options\n}","preventionTips":["Use option values straight from your Cassandra version's documentation; never free-form strings.","Validate CQL-generated compression options in CI against schema creation.","Centralize compression option templates in one reviewed place."],"tags":["lz4","compression","configuration","cql"],"backgroundTag":"invalid-enum-value","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"}