apache/cassandra · warning

Failed to create compressor {}. Will attempt fallback to def

Error message

Failed to create compressor {}. Will attempt fallback to default if enabled. Message: {}

What it means

CompressorRegistry.getCompressor logs this warning when a custom (non-default) compression provider fails to create the requested compressor. Since the provider is not the DEFAULT_COMPRESSION_PROVIDER, the registry first attempts to fall back to the default provider to build the compressor; the original exception is rethrown only if the provider is configured with failOnMissingProvider (or if the default provider itself was asked for and failed). This indicates a problem with a custom compression provider class or its configuration, usually a missing JAR/class, bad compression parameters, or provider initialization failure.

Source

Thrown at src/java/org/apache/cassandra/io/compress/CompressorRegistry.java:168

     *
     * @param compressorClass    compressor class to create a compressor of
     * @param compressionOptions compressor options
     * @return an instance of a given compressor class
     */
    public ICompressor getCompressor(Class<?> compressorClass, Map<String, String> compressionOptions)
    {
        AbstractCompressionProvider provider = getProvider(compressorClass);
        ICompressor compressor;
        try
        {
            compressor = provider.createCompressor(compressorClass, compressionOptions);
        }
        catch (Throwable t)
        {
            if (provider == DEFAULT_COMPRESSION_PROVIDER)
                throw t;

            logger.warn("Failed to create compressor {}. Will attempt fallback to default if enabled. Message: {}",
                        compressorClass.getName(),
                        t.getMessage());

            if (provider.isFailOnMissingProvider())
                throw t;

            compressor = DEFAULT_COMPRESSION_PROVIDER.createCompressor(compressorClass, compressionOptions);
        }

        // Validate the masquerade target for both the provider and the fallback path: whatever is
        // returned must serialize as exactly the compressor class that was requested, otherwise the
        // schema / on-disk format would record a name that cannot be resolved on peers and restarts.
        Class<? extends ICompressor> serializedAs = compressor.serializedAs();
        if (serializedAs == null || serializedAs.getSimpleName().isEmpty())
            throw new ConfigurationException(String.format("ICompressor.serializedAs() of a compressor created by provider %s returned %s. " +
                                                           "It must return a non-anonymous built-in compressor class in package " +
                                                           "org.apache.cassandra.io.compress.",
                                                           provider.getClass(),

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Ensure the custom compressor class and all its dependencies are present on the classpath of every node (lib/ directory) and that the class name is correct
  2. Validate the compression options map passed to createCompressor (chunk length, parameters) against what the provider expects
  3. If the compressor is not actually needed, revert the table's compression settings to a built-in compressor (LZ4Compressor, SnappyCompressor, DeflateCompressor)
  4. If you want hard failure instead of fallback, set the provider's failOnMissingProvider to true; otherwise verify the default-provider fallback produced the expected compressor

Example fix

// before: options referencing a class not shipped on all nodes
CREATE TABLE ks.t (...) WITH compression = {'class':'com.example.MyZstdCompressor','chunk_length_kb':'64'};
// after: ship the JAR to every node (lib/) or use a built-in compressor
CREATE TABLE ks.t (...) WITH compression = {'class':'org.apache.cassandra.io.compress.ZstdCompressor','chunk_length_kb':'64'};
Defensive patterns

Strategy: fallback

Validate before calling

// before configuring a custom compressor, verify the class loads on every node
Class.forName("com.example.MyZstdCompressor"); // must succeed on all nodes
// and confirm the provider is registered for this class
if (registry.getProvider(compressorClass) == CompressorRegistry.DEFAULT_COMPRESSION_PROVIDER)
    logger.warn("No custom provider registered; default provider will be used");

Try / catch

try
{
    ICompressor c = registry.getCompressor(compressorClass, options);
}
catch (Throwable t)
{
    // fallback also failed - fail fast with a clear configuration error
    throw new ConfigurationException("Compressor " + compressorClass.getName() +
                                     " could not be created by custom or default provider", t);
}

Prevention

When it happens

Trigger: Configuring a custom compression class via compression providers (e.g. class_name in compression options or a registered custom provider) where provider.createCompressor throws - missing dependency class, invalid compression_chunk_length/options, or provider bug; observed when creating/altering a table with compression or at SSTable write time.

Common situations: Custom compressor JAR not shipped on all nodes (classloader/classpath mismatch); typo'd or unsupported compression options map; zstd/lz4 native libs unavailable for a custom provider; failOnMissingProvider set so the fallback path rethrows after the warning.

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/d1e7f6ccda02ac04. Report an issue: GitHub.