{"record":{"id":"faaaee4825f1ea76","repo":"apache/cassandra","slug":"err-wrong-config","errorCode":"ERR_WRONG_CONFIG","errorMessage":"Unable to instantiate a compressor for class %s for the purposes of a startup check from provider %s.","messagePattern":"Unable to instantiate a compressor for class (.+?) for the purposes of a startup check from provider (.+?)\\.","errorType":"error_code","errorClass":"StartupException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/StartupChecks.java","lineNumber":395,"sourceCode":"            logger.info(\"Running compression smoke test for {} custom provider(s) with seed {}. \" +\n                        \"To reproduce a failure, regenerate the 4 KiB payload with new java.util.Random({}).\",\n                        providers.size(), seed, seed);\n\n            List<String> failedProviders = new ArrayList<>();\n            for (Map.Entry<Class<?>, AbstractCompressionProvider> entry : providers.entrySet())\n            {\n                Class<?> compressorClass = entry.getKey();\n                AbstractCompressionProvider provider = entry.getValue();\n\n                ICompressor custom;\n\n                try\n                {\n                    custom = provider.createCompressor(compressorClass, Collections.emptyMap());\n                }\n                catch (Throwable t)\n                {\n                    throw new StartupException(StartupException.ERR_WRONG_CONFIG,\n                                               String.format(\"Unable to instantiate a compressor for class %s \" +\n                                                             \"for the purposes of a startup check from provider %s.\",\n                                                             compressorClass.getName(),\n                                                             provider.getClass().getName()));\n                }\n\n                if (custom.serializedAs() != compressorClass)\n                {\n                    throw new StartupException(StartupException.ERR_WRONG_CONFIG,\n                                               String.format(\"Provider %s returned a compressor whose serializedAs() is %s, \" +\n                                                             \"but it must be %s (the built-in it substitutes for).\",\n                                                             provider.getClass().getName(),\n                                                             custom.serializedAs(),\n                                                             compressorClass.getName()));\n                }\n\n                ICompressor builtin = CompressorRegistry.DEFAULT_COMPRESSION_PROVIDER.createCompressor(compressorClass, Collections.emptyMap());\n","sourceCodeStart":377,"sourceCodeEnd":413,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/StartupChecks.java#L377-L413","documentation":"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.","triggerScenarios":"execute() iterates CompressorRegistry custom providers; provider.createCompressor(compressorClass, emptyMap()) throws for a given compressorClass (constructor failure, unsupported parameters, provider bug).","commonSituations":"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.","solutions":["Fix the provider so createCompressor works with an empty parameter map","Check the chained cause StartupException for the real instantiation error","Ensure the provider jar's dependencies are on the classpath","Verify the provider targets the Cassandra version in use"],"exampleFix":"// before\npublic ICompressor createCompressor(Class<? extends ICompressor> clazz, Map<String,String> params) { return build(params.get(\"required_key\")); } // NPE on empty map\n// after\npublic ICompressor createCompressor(Class<? extends ICompressor> clazz, Map<String,String> params) { return build(params.getOrDefault(\"required_key\", DEFAULT)); }","handlingStrategy":"try-catch","validationCode":"new MyProvider().createCompressor(LZ4Compressor.class, Collections.emptyMap()) // run in a unit test with empty params","typeGuard":null,"tryCatchPattern":"try { registry.getCustomProviders(); } catch (StartupException e) { log.error(\"Provider instantiation failed\", e.getCause()); }","preventionTips":["Providers must tolerate an empty parameter map","Unit-test createCompressor for every supported built-in class","Avoid requiring config keys inside providers"],"tags":["compression","provider","startup"],"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-17T15:17:12.973Z"}