apache/cassandra · error · ConfigurationException
Could not create Compression for type
Error message
Could not create Compression for type
What it means
parseCompressorClass resolves the configured compression class name via the classloader as an ICompressor implementation. If the class cannot be found (ClassNotFoundException/NoClassDefFoundError), it wraps the failure in a ConfigurationException reading 'Could not create Compression for type <name>'.
Source
Thrown at src/java/org/apache/cassandra/schema/CompressionParams.java:319
public int maxCompressedLength()
{
return maxCompressedLength;
}
private static Class<? extends ICompressor> parseCompressorClass(String className) throws ConfigurationException
{
if (className == null || className.isEmpty())
return null;
className = className.contains(".") ? className : "org.apache.cassandra.io.compress." + className;
try
{
return FBUtilities.classForNameWithoutInitialization(className, "compression", ICompressor.class);
}
catch (ConfigurationException e)
{
if (e.getCause() instanceof ClassNotFoundException || e.getCause() instanceof NoClassDefFoundError)
throw new ConfigurationException("Could not create Compression for type " + className, e);
throw e;
}
}
private static ICompressor createCompressor(Class<? extends ICompressor> compressorClass, Map<String, String> compressionOptions) throws ConfigurationException
{
if (compressorClass == null)
{
if (!compressionOptions.isEmpty())
throw new ConfigurationException("Unknown compression options (" + compressionOptions.keySet() + ") since no compression class found");
return null;
}
return registry.getCompressor(compressorClass, compressionOptions);
}
public static ICompressor createCompressor(ParameterizedClass compression) throws ConfigurationException
{View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Use a built-in class name: LZ4Compressor, SnappyCompressor, DeflateCompressor, or ZstdCompressor
- Use the fully qualified name for custom compressors and ensure the jar is on the classpath of every node
- Check cassandra-env / lib/ for the custom compressor jar if restoring a foreign schema
Example fix
// before
compression = {'class': 'Lz4'}
// after
compression = {'class': 'LZ4Compressor'} Defensive patterns
Strategy: try-catch
Validate before calling
try { Class.forName(className); } catch (ClassNotFoundException e) { throw new IllegalArgumentException("Unknown compressor class: " + className); } Try / catch
try { compressionParams = CompressionParams.fromMap(opts); } catch (ConfigurationException e) { if (e.getMessage().startsWith("Could not create Compression for type")) { /* fall back to a built-in compressor */ } throw e; } Prevention
- Restrict schemas to built-in compressor classes (LZ4, Snappy, Deflate, Zstd)
- Ensure custom compressor jars are installed on all nodes before restoring schemas
- Verify class names survive upgrades (classes can be renamed/removed)
When it happens
Trigger: compression = {'class': 'SomeUnknownCompressor'} in a table schema; loading a schema snapshot that references a compression class not present in this Cassandra build or a missing third-party jar.
Common situations: Typos in class names; restoring schemas on a cluster without a custom compressor library installed; referencing removed compressor classes after an upgrade.
Related errors
- compressed_read_ahead_buffer_size must be at least 256KiB (s
- Failed to initialize crypto provider %s
- <ConfigurationException message>
- Unknown compression
- Invalid compression dictionary kind: %s
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/a537e2ec4ba8edff.
Report an issue: GitHub.