{"record":{"id":"d1e7f6ccda02ac04","repo":"apache/cassandra","slug":"failed-to-create-compressor-will-attempt-fallb","errorCode":null,"errorMessage":"Failed to create compressor {}. Will attempt fallback to default if enabled. Message: {}","messagePattern":"Failed to create compressor (.+?)\\. Will attempt fallback to default if enabled\\. Message: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/io/compress/CompressorRegistry.java","lineNumber":168,"sourceCode":"     *\n     * @param compressorClass    compressor class to create a compressor of\n     * @param compressionOptions compressor options\n     * @return an instance of a given compressor class\n     */\n    public ICompressor getCompressor(Class<?> compressorClass, Map<String, String> compressionOptions)\n    {\n        AbstractCompressionProvider provider = getProvider(compressorClass);\n        ICompressor compressor;\n        try\n        {\n            compressor = provider.createCompressor(compressorClass, compressionOptions);\n        }\n        catch (Throwable t)\n        {\n            if (provider == DEFAULT_COMPRESSION_PROVIDER)\n                throw t;\n\n            logger.warn(\"Failed to create compressor {}. Will attempt fallback to default if enabled. Message: {}\",\n                        compressorClass.getName(),\n                        t.getMessage());\n\n            if (provider.isFailOnMissingProvider())\n                throw t;\n\n            compressor = DEFAULT_COMPRESSION_PROVIDER.createCompressor(compressorClass, compressionOptions);\n        }\n\n        // Validate the masquerade target for both the provider and the fallback path: whatever is\n        // returned must serialize as exactly the compressor class that was requested, otherwise the\n        // schema / on-disk format would record a name that cannot be resolved on peers and restarts.\n        Class<? extends ICompressor> serializedAs = compressor.serializedAs();\n        if (serializedAs == null || serializedAs.getSimpleName().isEmpty())\n            throw new ConfigurationException(String.format(\"ICompressor.serializedAs() of a compressor created by provider %s returned %s. \" +\n                                                           \"It must return a non-anonymous built-in compressor class in package \" +\n                                                           \"org.apache.cassandra.io.compress.\",\n                                                           provider.getClass(),","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/io/compress/CompressorRegistry.java#L150-L186","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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","Validate the compression options map passed to createCompressor (chunk length, parameters) against what the provider expects","If the compressor is not actually needed, revert the table's compression settings to a built-in compressor (LZ4Compressor, SnappyCompressor, DeflateCompressor)","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"],"exampleFix":"// before: options referencing a class not shipped on all nodes\nCREATE TABLE ks.t (...) WITH compression = {'class':'com.example.MyZstdCompressor','chunk_length_kb':'64'};\n// after: ship the JAR to every node (lib/) or use a built-in compressor\nCREATE TABLE ks.t (...) WITH compression = {'class':'org.apache.cassandra.io.compress.ZstdCompressor','chunk_length_kb':'64'};","handlingStrategy":"fallback","validationCode":"// before configuring a custom compressor, verify the class loads on every node\nClass.forName(\"com.example.MyZstdCompressor\"); // must succeed on all nodes\n// and confirm the provider is registered for this class\nif (registry.getProvider(compressorClass) == CompressorRegistry.DEFAULT_COMPRESSION_PROVIDER)\n    logger.warn(\"No custom provider registered; default provider will be used\");","typeGuard":null,"tryCatchPattern":"try\n{\n    ICompressor c = registry.getCompressor(compressorClass, options);\n}\ncatch (Throwable t)\n{\n    // fallback also failed - fail fast with a clear configuration error\n    throw new ConfigurationException(\"Compressor \" + compressorClass.getName() +\n                                     \" could not be created by custom or default provider\", t);\n}","preventionTips":["Ship custom compressor JARs in lib/ on every node in the cluster before enabling them in schema","Validate compression options (chunk length, parameters) in a startup check","Prefer built-in compressors unless a provider is required; test custom providers on a staging cluster first","Set failOnMissingProvider when silent fallback to a different compressor would be unacceptable for on-disk format consistency"],"tags":["compression","configuration","classpath","fallback"],"backgroundTag":"invalid-config-value","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}