apache/cassandra · error · RuntimeException

Cannot create CompressionParams for stored parameters

Error message

Cannot create CompressionParams for stored parameters

What it means

CompressionMetadata.open() reads the stored compression parameters (compressor name, chunk length, options) from the -CompressionInfo.db file and rebuilds a CompressionParams. Because the parameters were persisted earlier, any ConfigurationException (unknown compressor, bad chunk size, invalid option) is rethrown as a RuntimeException noting the parameters came from stored metadata — the file cannot be read even though the schema that wrote it may have changed.

Source

Thrown at src/java/org/apache/cassandra/io/compress/CompressionMetadata.java:116

            int optionCount = stream.readInt();
            Map<String, String> options = new HashMap<>(optionCount);
            for (int i = 0; i < optionCount; ++i)
            {
                String key = stream.readUTF();
                String value = stream.readUTF();
                options.put(key, value);
            }
            int chunkLength = stream.readInt();
            int maxCompressedSize = Integer.MAX_VALUE;
            if (hasMaxCompressedSize)
                maxCompressedSize = stream.readInt();
            try
            {
                parameters = new CompressionParams(compressorName, chunkLength, maxCompressedSize, options);
            }
            catch (ConfigurationException e)
            {
                throw new RuntimeException("Cannot create CompressionParams for stored parameters", e);
            }

            dataLength = stream.readLong();
            chunkOffsets = readChunkOffsets(stream);
            compressionDictionary = CompressionDictionary.deserialize(stream, compressionDictionaryManager);
        }
        catch (FileNotFoundException | NoSuchFileException e)
        {
            throw new RuntimeException(e);
        }
        catch (IOException e)
        {
            throw new CorruptSSTableException(e, chunksIndexFile);
        }

        return new CompressionMetadata(chunksIndexFile, parameters,
                                       chunkOffsets, chunkOffsets.size(), dataLength,
                                       compressedLength, compressionDictionary);

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Install/register the missing compressor class (custom provider JAR) on this node
  2. Use nodetool scrub or recompress the table (e.g. alter table ... WITH compression + full repair/rewrite) so metadata is regenerated with valid parameters
  3. Fix cassandra.yaml/config so the compressor resolves; if downgrading, first rewrite SSTables with the older compressor
  4. Verify the CompressionInfo.db file is not corrupted by comparing with replicas

Example fix

// before
ALTER TABLE ks.t WITH compression = {'class': 'CustomCompressor'}; // then copy SSTables to node lacking the class
// after
ALTER TABLE ks.t WITH compression = {'class': 'LZ4Compressor'};
// then run a full rewrite (scrub/upgrade-sstables) before moving data between nodes
Defensive patterns

Strategy: validation

Validate before calling

// Pre-check compressor availability before opening stored metadata
String name = /* compressorName from CompressionInfo.db */;
if (!CompressorRegistry.instance.hasCompressor(name))
    throw new IllegalStateException("Compressor not available on this node: " + name);

Try / catch

try { CompressionMetadata.open(file, len); }
catch (RuntimeException e) { /* msg 'Cannot create CompressionParams...' */ reinstallOrRewriteSSTable(); }

Prevention

When it happens

Trigger: Opening a compressed SSTable whose CompressionInfo.db contains a compressor name not on the classpath/registry, an invalid chunk length, or options incompatible with the current CompressionParams validation.

Common situations: Downgrade or rolling upgrade where a newer compressor class is unavailable; SSTables copied from a cluster with custom compression providers; hand-edited or corrupted metadata files; removed custom compressor plugin.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/20cef0e1d442dd7b. Report an issue: GitHub.