apache/cassandra · error · org.apache.cassandra.exceptions.ConfigurationException
Invalid compressor type
Error message
Invalid compressor type '%s' specified for LZ4 parameter '%s'. Valid options are %s.
What it means
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.
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.
Example fix
// before
CREATE TABLE t (...) WITH compression = {'class':'LZ4Compressor','type':'hzigh'};
// after
CREATE TABLE t (...) WITH compression = {'class':'LZ4Compressor','type':'high'}; Defensive patterns
Strategy: validation
Validate before calling
Set<String> valid = Set.of("fast", "high");
if (type != null && !valid.contains(type)) throw new IllegalArgumentException("Invalid LZ4 type: " + type); Try / catch
try {
session.execute("CREATE TABLE t (...) WITH compression = {'class':'LZ4Compressor','type':'?'}", type);
} catch (ConfigurationException e) {
// fall back to default LZ4 options
} Prevention
- 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.
When it happens
Trigger: 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').
Common situations: 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.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Cannot create CompressionParams for stored parameters
- Cannot create table . with transactional mode with…
- commitlog_disk_access_mode =
- compressed_read_ahead_buffer_size_in_kb must be at least…
- compressed_read_ahead_buffer_size must be at least 256KiB…
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/c9a3ab3bcb353924.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/io/compress/LZ4Compressor.java:206
if (input.remaining() > 0)
{
throw new IOException("Compressed lengths mismatch - "+input.remaining()+" bytes remain");
}
}
public Set<String> supportedOptions()
{
return new HashSet<>(Arrays.asList(LZ4_HIGH_COMPRESSION_LEVEL, LZ4_COMPRESSOR_TYPE));
}
public static String validateCompressorType(String compressorType) throws ConfigurationException
{
if (compressorType == null)
return DEFAULT_LZ4_COMPRESSOR_TYPE;
if (!VALID_COMPRESSOR_TYPES.contains(compressorType))
{
throw new ConfigurationException(String.format("Invalid compressor type '%s' specified for LZ4 parameter '%s'. "
+ "Valid options are %s.", compressorType, LZ4_COMPRESSOR_TYPE,
VALID_COMPRESSOR_TYPES.toString()));
}
else
{
return compressorType;
}
}
public static Integer validateCompressionLevel(String compressionLevel) throws ConfigurationException
{
if (compressionLevel == null)
return DEFAULT_HIGH_COMPRESSION_LEVEL;
ConfigurationException ex = new ConfigurationException("Invalid value [" + compressionLevel + "] for parameter '"
+ LZ4_HIGH_COMPRESSION_LEVEL + "'. Value must be between 1 and 17.");
Integer level;View on GitHub (pinned to 88fd0f6a0e)