apache/cassandra · error · ConfigurationException

The 'class_name' option must be specified.

Error message

The 'class_name' option must be specified.

What it means

Thrown from MemtableParams.getMemtableFactory when a memtable configuration entry (other than the built-in default) lacks a 'class_name' option. Cassandra needs the fully-qualified or short memtable class name to instantiate the Memtable.Factory, so a ConfigurationException is raised.

Source

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

    private static MemtableParams parseConfiguration(String configurationKey)
    {
        ParameterizedClass definition = CONFIGURATION_DEFINITIONS.get(configurationKey);

        if (definition == null)
            throw new ConfigurationException("Memtable configuration \"" + configurationKey + "\" not found.");
        return new MemtableParams(getMemtableFactory(definition), configurationKey);
    }


    private static Memtable.Factory getMemtableFactory(ParameterizedClass options)
    {
        // Special-case this so that we don't initialize memtable class for tests that need to delay that.
        if (options == DEFAULT_CONFIGURATION)
            return DEFAULT_MEMTABLE_FACTORY;

        String className = options.class_name;
        if (className == null || className.isEmpty())
            throw new ConfigurationException("The 'class_name' option must be specified.");

        className = className.contains(".") ? className : "org.apache.cassandra.db.memtable." + className;
        try
        {
            Memtable.Factory factory;
            Class<?> clazz = Class.forName(className, false, MemtableParams.class.getClassLoader());
            final Map<String, String> parametersCopy = options.parameters != null
                                                       ? new HashMap<>(options.parameters)
                                                       : new HashMap<>();
            try
            {
                Method factoryMethod = clazz.getDeclaredMethod("factory", Map.class);
                if (!Memtable.Factory.class.isAssignableFrom(factoryMethod.getReturnType()))
                    throw new ClassCastException("Memtable factory method on " + className +
                                                 " must return " + Memtable.Factory.class.getName());
                factory = (Memtable.Factory) factoryMethod.invoke(null, parametersCopy);
            }
            catch (NoSuchMethodException e)

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Add class_name to the memtable configuration entry in cassandra.yaml (short names are expanded to org.apache.cassandra.db.memtable.*).
  2. Ensure the entry inherits from a base entry that actually defines class_name.
  3. Fix the YAML key spelling to exactly class_name and verify indentation.

Example fix

# before (cassandra.yaml)
memtable_configurations:
  cheap:
    inherits: default
# after
memtable_configurations:
  cheap:
    inherits: default
    class_name: org.apache.cassandra.db.memtable.SkipListMemtable
Defensive patterns

Strategy: validation

Validate before calling

# ensure every non-default entry has a class_name (possibly via inherited entry)
python3 -c "import yaml; c=yaml.safe_load(open('conf/cassandra.yaml')); mc=c.get('memtable_configurations',{}); [print('missing class_name:',k) for k,v in mc.items() if isinstance(v,dict) and not v.get('class_name') and not any(mc.get(i,{}).get('class_name') for i in [v.get('inherits')] if i)]"

Prevention

When it happens

Trigger: cassandra.yaml memtable_configurations entry like 'my_conf: {inherits: default}' or an entry whose class_name key is empty/missing, resolved via parseConfiguration -> getMemtableFactory at startup; inheritance expands parameters but class_name may still be absent if neither the entry nor any inherited entry defines it.

Common situations: Writing an entry that only sets parameters assuming the class is inherited but the base entry also lacks class_name, YAML indentation error placing class_name under the wrong key, typos like class-name or classname.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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