apache/cassandra · error · ConfigurationException

Could not create memtable factory for class

Error message

Could not create memtable factory for class ${options}

What it means

This ConfigurationException is thrown by MemtableParams.getMemtableFactory when it fails to instantiate the configured memtable factory class. Cassandra wraps reflective construction failures (class not found, inaccessible Holder/constructor, wrong type, or an underlying ConfigurationException) so invalid memtable configuration fails fast at parse time instead of at runtime.

Solutions

  1. Check the memtable factory class name in the configuration for typos and confirm the class exists in this Cassandra version (org.apache.cassandra.memtable.* defaults).
  2. Read the wrapped cause exception ('caused by') to see whether the class was missing, not instantiable, or its constructor threw ConfigurationException, and fix accordingly.
  3. If using a custom memtable factory, ensure it implements Memtable.Factory, exposes a public static Singleton Holder or no-arg constructor, and is on the classpath.
  4. Revert to the default memtable factory (e.g. SkipListMemtable) if the configured class is not supported in this build.

Example fix

// before (cassandra.yaml)
memtable:
  class_name: org.apache.cassandra.memtable.ChunkedMemtable
// after
memtable:
  class_name: org.apache.cassandra.memtable.TrieMemtable
Defensive patterns

Strategy: validation

Validate before calling

String cls = conf.memtableClassName;
if (cls != null) {
    try { Class.forName(cls); }
    catch (ClassNotFoundException e) { throw new IllegalArgumentException("Unknown memtable factory: " + cls, e); }
}

Type guard

boolean isValidMemtableFactory(String name) {
    return name == null || name.startsWith("org.apache.cassandra.memtable.");
}

Try / catch

try {
    keyspace = schema.validateTable(ks, table);
} catch (ConfigurationException e) {
    logger.error("Bad memtable factory config: {}", e.getMessage(), e.getCause());
    throw new StartupAbort(e);
}

Prevention

When it happens

Trigger: cassandra.yaml or ALTER KEYSPACE sets a memtable class name that is misspelled, not on the classpath, has no accessible static Singleton Holder or constructor, or whose constructor throws (e.g. invalid options passed to it); parseConfiguration calls getMemtableFactory with these bad options.

Common situations: Typos in the memtable class name; upgrading/downgrading Cassandra so a previously valid memtable factory class no longer exists; a custom memtable factory's constructor throwing ConfigurationException due to bad options; copying config from a patch branch (e.g. configurable-memtable prototypes) to a GA build.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/1368f4a74d15ab00. Report an issue: GitHub.

Appendix: source

Thrown at src/java/org/apache/cassandra/schema/MemtableParams.java:261

            catch (NoSuchMethodException e)
            {
                // continue with FACTORY field
                Field factoryField = clazz.getDeclaredField("FACTORY");
                if (!Memtable.Factory.class.isAssignableFrom(factoryField.getType()))
                    throw new ClassCastException("Memtable FACTORY field on " + className +
                                                 " must be of type " + Memtable.Factory.class.getName());
                factory = (Memtable.Factory) factoryField.get(null);
            }
            if (!parametersCopy.isEmpty())
                throw new ConfigurationException("Memtable class " + className + " does not accept any futher parameters, but " +
                                                 parametersCopy + " were given.");
            return factory;
        }
        catch (NoSuchFieldException | ClassNotFoundException | IllegalAccessException | InvocationTargetException | ClassCastException e)
        {
            if (e.getCause() instanceof ConfigurationException)
                throw (ConfigurationException) e.getCause();
            throw new ConfigurationException("Could not create memtable factory for class " + options, e);
        }
    }
}

View on GitHub (pinned to 88fd0f6a0e)