apache/cassandra · error · StartupException

ERR_WRONG_CONFIG

ERR_WRONG_CONFIG

Error message

Unable to instantiate a compressor for class %s for the purposes of a startup check from provider %s.

What it means

A custom compression provider registered for the startup smoke test was asked to create an instance of a built-in compressor class it substitutes for, but creation threw. Cassandra converts any Throwable into StartupException(ERR_WRONG_CONFIG) because a provider that cannot instantiate its substitute cannot be validated.

Solutions

  1. Fix the provider so createCompressor works with an empty parameter map
  2. Check the chained cause StartupException for the real instantiation error
  3. Ensure the provider jar's dependencies are on the classpath
  4. Verify the provider targets the Cassandra version in use

Example fix

// before
public ICompressor createCompressor(Class<? extends ICompressor> clazz, Map<String,String> params) { return build(params.get("required_key")); } // NPE on empty map
// after
public ICompressor createCompressor(Class<? extends ICompressor> clazz, Map<String,String> params) { return build(params.getOrDefault("required_key", DEFAULT)); }
Defensive patterns

Strategy: try-catch

Validate before calling

new MyProvider().createCompressor(LZ4Compressor.class, Collections.emptyMap()) // run in a unit test with empty params

Try / catch

try { registry.getCustomProviders(); } catch (StartupException e) { log.error("Provider instantiation failed", e.getCause()); }

Prevention

When it happens

Trigger: execute() iterates CompressorRegistry custom providers; provider.createCompressor(compressorClass, emptyMap()) throws for a given compressorClass (constructor failure, unsupported parameters, provider bug).

Common situations: Provider requires config parameters that the smoke test passes as empty map, provider jar missing dependencies, provider written for a different Cassandra ICompressor API version.

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

Appendix: source

Thrown at src/java/org/apache/cassandra/service/StartupChecks.java:395

            logger.info("Running compression smoke test for {} custom provider(s) with seed {}. " +
                        "To reproduce a failure, regenerate the 4 KiB payload with new java.util.Random({}).",
                        providers.size(), seed, seed);

            List<String> failedProviders = new ArrayList<>();
            for (Map.Entry<Class<?>, AbstractCompressionProvider> entry : providers.entrySet())
            {
                Class<?> compressorClass = entry.getKey();
                AbstractCompressionProvider provider = entry.getValue();

                ICompressor custom;

                try
                {
                    custom = provider.createCompressor(compressorClass, Collections.emptyMap());
                }
                catch (Throwable t)
                {
                    throw new StartupException(StartupException.ERR_WRONG_CONFIG,
                                               String.format("Unable to instantiate a compressor for class %s " +
                                                             "for the purposes of a startup check from provider %s.",
                                                             compressorClass.getName(),
                                                             provider.getClass().getName()));
                }

                if (custom.serializedAs() != compressorClass)
                {
                    throw new StartupException(StartupException.ERR_WRONG_CONFIG,
                                               String.format("Provider %s returned a compressor whose serializedAs() is %s, " +
                                                             "but it must be %s (the built-in it substitutes for).",
                                                             provider.getClass().getName(),
                                                             custom.serializedAs(),
                                                             compressorClass.getName()));
                }

                ICompressor builtin = CompressorRegistry.DEFAULT_COMPRESSION_PROVIDER.createCompressor(compressorClass, Collections.emptyMap());

View on GitHub (pinned to 88fd0f6a0e)