{"record":{"id":"40e8a84e324e7a0b","repo":"apache/cassandra","slug":"s-create-threw-an-error-s-s","errorCode":null,"errorMessage":"%s.create() threw an error: %s %s","messagePattern":"(.+?)\\.create\\(\\) threw an error: (.+?) (.+?)","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/io/compress/DefaultCompressionProvider.java","lineNumber":95,"sourceCode":"        }\n        catch (SecurityException e)\n        {\n            throw new ConfigurationException(\"Access forbidden\", e);\n        }\n        catch (IllegalAccessException e)\n        {\n            throw new ConfigurationException(\"Cannot access method create in \" + compressorClass.getName(), e);\n        }\n        catch (InvocationTargetException e)\n        {\n            if (e.getTargetException() instanceof ConfigurationException)\n                throw (ConfigurationException) e.getTargetException();\n\n            Throwable cause = e.getCause() == null\n                            ? e\n                            : e.getCause();\n\n            throw new ConfigurationException(format(\"%s.create() threw an error: %s %s\",\n                                                    compressorClass.getSimpleName(),\n                                                    cause.getClass().getName(),\n                                                    cause.getMessage()),\n                                             e);\n        }\n        catch (ExceptionInInitializerError e)\n        {\n            throw new ConfigurationException(\"Cannot initialize class \" + compressorClass.getName());\n        }\n    }\n}\n","sourceCodeStart":77,"sourceCodeEnd":107,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/io/compress/DefaultCompressionProvider.java#L77-L107","documentation":"The compressor's static create(Map) method itself threw an exception at runtime; the reflective InvocationTargetException wraps it. If the target exception is a ConfigurationException it is rethrown directly; otherwise this message is thrown, reporting the create() failure with the cause class name and message so the real error (bad options, OOM, native lib crash) is visible.","triggerScenarios":"createCompressor() invoking create(Map) on a compressor whose body throws any non-ConfigurationException — e.g. invalid chunk_length_kb value, OutOfMemoryError while allocating, UnsatisfiedLinkError from a missing native LZ4/Snappy library, or IllegalArgumentException for malformed parameters.","commonSituations":"Missing/incompatible native compression libraries on the host; compression option values out of valid range (chunk length too small/large); corrupted option strings; OOM in memory-constrained environments during table creation or startup.","solutions":["Read the cause class and message embedded in the error to identify the actual failure and fix it (e.g. install the matching native library, correct the option value).","Validate compression option values (ranges, formats) before applying them; the inner ConfigurationException path would have shown a clearer message.","Check Cassandra's system.log for the full stack trace attached via the wrapped InvocationTargetException.","Increase heap if the cause is OutOfMemoryError, or reduce chunk_length_kb."],"exampleFix":"// before\ncompression = {'sstable_compression':'LZ4Compressor','chunk_length_kb':'0'}\n// after\ncompression = {'sstable_compression':'LZ4Compressor','chunk_length_kb':'64'}","handlingStrategy":"try-catch","validationCode":"try {\n    compressorClass.getMethod(\"create\", Map.class).invoke(null, myOptions);\n} catch (InvocationTargetException e) {\n    throw new IllegalStateException(\"create() would fail: \" + e.getCause(), e.getCause());\n}","typeGuard":null,"tryCatchPattern":"try {\n    registry.getCompressor(LZ4Compressor.class, opts);\n} catch (ConfigurationException e) {\n    if (e.getMessage().contains(\".create() threw an error\")) log.error(\"create() failed: {}\", e.getCause(), e);\n    throw e;\n}","preventionTips":["Validate option values (ranges, formats) before passing them to compression","Ensure native compression libraries are installed and ABI-compatible in the deployment image","Reproduce compressor creation in a standalone test to capture the raw cause stack trace","Monitor heap; create() allocations can OOM on constrained nodes"],"tags":["compression","reflection","runtime"],"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-14T16:17:12.679Z"}