apache/cassandra · error · ConfigurationException

%s.create() threw an error: %s %s

Error message

%s.create() threw an error: %s %s

What it means

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.

Source

Thrown at src/java/org/apache/cassandra/io/compress/DefaultCompressionProvider.java:95

        }
        catch (SecurityException e)
        {
            throw new ConfigurationException("Access forbidden", e);
        }
        catch (IllegalAccessException e)
        {
            throw new ConfigurationException("Cannot access method create in " + compressorClass.getName(), e);
        }
        catch (InvocationTargetException e)
        {
            if (e.getTargetException() instanceof ConfigurationException)
                throw (ConfigurationException) e.getTargetException();

            Throwable cause = e.getCause() == null
                            ? e
                            : e.getCause();

            throw new ConfigurationException(format("%s.create() threw an error: %s %s",
                                                    compressorClass.getSimpleName(),
                                                    cause.getClass().getName(),
                                                    cause.getMessage()),
                                             e);
        }
        catch (ExceptionInInitializerError e)
        {
            throw new ConfigurationException("Cannot initialize class " + compressorClass.getName());
        }
    }
}

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. 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).
  2. Validate compression option values (ranges, formats) before applying them; the inner ConfigurationException path would have shown a clearer message.
  3. Check Cassandra's system.log for the full stack trace attached via the wrapped InvocationTargetException.
  4. Increase heap if the cause is OutOfMemoryError, or reduce chunk_length_kb.

Example fix

// before
compression = {'sstable_compression':'LZ4Compressor','chunk_length_kb':'0'}
// after
compression = {'sstable_compression':'LZ4Compressor','chunk_length_kb':'64'}
Defensive patterns

Strategy: try-catch

Validate before calling

try {
    compressorClass.getMethod("create", Map.class).invoke(null, myOptions);
} catch (InvocationTargetException e) {
    throw new IllegalStateException("create() would fail: " + e.getCause(), e.getCause());
}

Try / catch

try {
    registry.getCompressor(LZ4Compressor.class, opts);
} catch (ConfigurationException e) {
    if (e.getMessage().contains(".create() threw an error")) log.error("create() failed: {}", e.getCause(), e);
    throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

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