{"record":{"id":"6d73a916e5c8174d","repo":"apache/cassandra","slug":"missing-sub-option-s-for-the-compression-opti","errorCode":null,"errorMessage":"Missing sub-option '%s' for the 'compression' option.","messagePattern":"Missing sub-option '(.+?)' for the 'compression' option\\.","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/schema/CompressionParams.java","lineNumber":95,"sourceCode":"                                                                       1024 * 4,\n                                                                       Integer.MAX_VALUE,\n                                                                       DEFAULT_MIN_COMPRESS_RATIO,\n                                                                       Collections.emptyMap());\n\n    private final ICompressor sstableCompressor;\n    private final int chunkLength;\n    private final int maxCompressedLength;  // In content we store max length to avoid rounding errors causing compress/decompress mismatch.\n    private final double minCompressRatio;  // In configuration we store min ratio, the input parameter.\n    private final ImmutableMap<String, String> otherOptions; // Unrecognized options, can be used by the compressor\n\n    public static CompressionParams fromMap(Map<String, String> opts)\n    {\n        Map<String, String> options = copyOptions(opts);\n\n        String sstableCompressionClass;\n\n        if (!opts.isEmpty() && isEnabled(opts) && !options.containsKey(CLASS))\n            throw new ConfigurationException(format(\"Missing sub-option '%s' for the 'compression' option.\", CLASS));\n\n        if (!removeEnabled(options) && !options.isEmpty())\n            throw new ConfigurationException(format(\"If the '%s' option is set to false no other options must be specified\", ENABLED));\n        else\n            sstableCompressionClass = removeSSTableCompressionClass(options);\n\n        int chunkLength = removeChunkLength(options);\n        double minCompressRatio = removeMinCompressRatio(options);\n\n        CompressionParams cp = new CompressionParams(sstableCompressionClass, options, chunkLength, minCompressRatio);\n        cp.validate();\n\n        return cp;\n    }\n\n    public Class<? extends ICompressor> klass()\n    {\n        return sstableCompressor.getClass();","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/schema/CompressionParams.java#L77-L113","documentation":"CompressionParams.fromMap requires a 'class' sub-option (the sstable compression algorithm) whenever compression is enabled and any options are given. If options are present and enabled but the class is missing, a ConfigurationException is thrown.","triggerScenarios":"CREATE TABLE with compression = {'chunk_length_in_kb': '16'} and no 'class' key; programmatic fromMap with enabled=true and options but no compression class.","commonSituations":"Users copying chunk_length/other tuning options from examples while omitting the class; scripts that strip the class key during map manipulation.","solutions":["Add the compression class, e.g. compression = {'class': 'LZ4Compressor', 'chunk_length_in_kb': '16'}","If you intend to disable compression, set 'enabled': 'false' and remove other options","Verify map-merging code does not drop the 'class' entry"],"exampleFix":"// before\ncompression = {'chunk_length_in_kb': '16'}\n// after\ncompression = {'class': 'LZ4Compressor', 'chunk_length_in_kb': '16'}","handlingStrategy":"validation","validationCode":"if (!opts.isEmpty() && !\"false\".equalsIgnoreCase(opts.getOrDefault(\"enabled\", \"true\")) && !opts.containsKey(\"class\"))\n    throw new IllegalArgumentException(\"compression options require a 'class' sub-option when enabled\");","typeGuard":"boolean hasCompressionClass(Map<String,String> m) { return m.containsKey(\"class\") && !m.get(\"class\").trim().isEmpty(); }","tryCatchPattern":"try { compressionParams = CompressionParams.fromMap(opts); } catch (ConfigurationException e) { if (e.getMessage().contains(\"Missing sub-option\")) { /* add class key */ } throw e; }","preventionTips":["Include the compressor class whenever compression options are present","If disabling, use only {'enabled':'false'}","Lint compression maps for the class key before schema submission"],"tags":["cassandra","schema","compression"],"backgroundTag":"missing-required-option","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"}