{"record":{"id":"1368f4a74d15ab00","repo":"apache/cassandra","slug":"could-not-create-memtable-factory-for-class-opti","errorCode":null,"errorMessage":"Could not create memtable factory for class ${options}","messagePattern":"Could not create memtable factory for class (.+?)","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/schema/MemtableParams.java","lineNumber":261,"sourceCode":"            catch (NoSuchMethodException e)\n            {\n                // continue with FACTORY field\n                Field factoryField = clazz.getDeclaredField(\"FACTORY\");\n                if (!Memtable.Factory.class.isAssignableFrom(factoryField.getType()))\n                    throw new ClassCastException(\"Memtable FACTORY field on \" + className +\n                                                 \" must be of type \" + Memtable.Factory.class.getName());\n                factory = (Memtable.Factory) factoryField.get(null);\n            }\n            if (!parametersCopy.isEmpty())\n                throw new ConfigurationException(\"Memtable class \" + className + \" does not accept any futher parameters, but \" +\n                                                 parametersCopy + \" were given.\");\n            return factory;\n        }\n        catch (NoSuchFieldException | ClassNotFoundException | IllegalAccessException | InvocationTargetException | ClassCastException e)\n        {\n            if (e.getCause() instanceof ConfigurationException)\n                throw (ConfigurationException) e.getCause();\n            throw new ConfigurationException(\"Could not create memtable factory for class \" + options, e);\n        }\n    }\n}\n","sourceCodeStart":243,"sourceCodeEnd":265,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/schema/MemtableParams.java#L243-L265","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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).","Read the wrapped cause exception ('caused by') to see whether the class was missing, not instantiable, or its constructor threw ConfigurationException, and fix accordingly.","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.","Revert to the default memtable factory (e.g. SkipListMemtable) if the configured class is not supported in this build."],"exampleFix":"// before (cassandra.yaml)\nmemtable:\n  class_name: org.apache.cassandra.memtable.ChunkedMemtable\n// after\nmemtable:\n  class_name: org.apache.cassandra.memtable.TrieMemtable","handlingStrategy":"validation","validationCode":"String cls = conf.memtableClassName;\nif (cls != null) {\n    try { Class.forName(cls); }\n    catch (ClassNotFoundException e) { throw new IllegalArgumentException(\"Unknown memtable factory: \" + cls, e); }\n}","typeGuard":"boolean isValidMemtableFactory(String name) {\n    return name == null || name.startsWith(\"org.apache.cassandra.memtable.\");\n}","tryCatchPattern":"try {\n    keyspace = schema.validateTable(ks, table);\n} catch (ConfigurationException e) {\n    logger.error(\"Bad memtable factory config: {}\", e.getMessage(), e.getCause());\n    throw new StartupAbort(e);\n}","preventionTips":["Validate cassandra.yaml memtable class names after every Cassandra version upgrade.","Only use memtable factory classes shipped with or documented for your Cassandra version.","Read the wrapped cause when this error fires — it distinguishes class-not-found from constructor failures.","Test custom memtable factories in a staging cluster before rollout."],"tags":["config","reflection","memtable"],"backgroundTag":"class-not-found","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"}