{"record":{"id":"4a8500a9811585cc","repo":"apache/cassandra","slug":"s-4a8500","errorCode":null,"errorMessage":"%s","messagePattern":"%s","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/locator/AbstractReplicationStrategy.java","lineNumber":264,"sourceCode":"        return null;\n    }\n\n    private static AbstractReplicationStrategy createInternal(String keyspaceName,\n                                                              Class<? extends AbstractReplicationStrategy> strategyClass,\n                                                              Map<String, String> strategyOptions)\n        throws ConfigurationException\n    {\n        AbstractReplicationStrategy strategy;\n        Class<?>[] parameterTypes = new Class[] {String.class, Map.class};\n        try\n        {\n            Constructor<? extends AbstractReplicationStrategy> constructor = strategyClass.getConstructor(parameterTypes);\n            strategy = constructor.newInstance(keyspaceName, strategyOptions);\n        }\n        catch (InvocationTargetException e)\n        {\n            Throwable targetException = e.getTargetException();\n            throw new ConfigurationException(targetException.getMessage(), targetException);\n        }\n        catch (Exception e)\n        {\n            throw new ConfigurationException(\"Error constructing replication strategy class\", e);\n        }\n        return strategy;\n    }\n\n    public static AbstractReplicationStrategy createReplicationStrategy(String keyspaceName,\n                                                                        ReplicationParams replicationParams)\n    {\n        return createReplicationStrategy(keyspaceName, replicationParams.klass, replicationParams.options);\n    }\n    public static AbstractReplicationStrategy createReplicationStrategy(String keyspaceName,\n                                                                        Class<? extends AbstractReplicationStrategy> strategyClass,\n                                                                        Map<String, String> strategyOptions)\n    {\n        AbstractReplicationStrategy strategy = createInternal(keyspaceName, strategyClass, strategyOptions);","sourceCodeStart":246,"sourceCodeEnd":282,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/locator/AbstractReplicationStrategy.java#L246-L282","documentation":"When createInternal reflectively instantiates a replication strategy class, any exception thrown inside the strategy's constructor is wrapped in InvocationTargetException. Cassandra unwraps it and rethrows ConfigurationException with the target exception's own message (the %s placeholder). The real cause text is whatever the strategy constructor reported (e.g. a bad replication factor or unknown option).","triggerScenarios":"CREATE KEYSPACE / ALTER KEYSPACE with a replication option that the strategy constructor rejects — e.g. NetworkTopologyStrategy with an invalid RF like 'dc1: abc' or SimpleStrategy with non-numeric replication_factor.","commonSituations":"Typo'd replication_factor ('3L', 'three'), negative or zero RF, per-DC RF strings with bad format, invalid option names in replication map.","solutions":["Read the inner message: it names the constructor argument that failed validation","Correct the replication options in the CREATE/ALTER KEYSPACE statement","Use valid syntax: {'class': 'NetworkTopologyStrategy', 'dc1': '3'} — RF values must be positive integers or 'N/short' transient forms","Validate the strategy options first via AbstractReplicationStrategy.validateReplicationStrategy"],"exampleFix":"// before\nCREATE KEYSPACE ks WITH replication = {'class':'NetworkTopologyStrategy','dc1':'abc'};\n// after\nCREATE KEYSPACE ks WITH replication = {'class':'NetworkTopologyStrategy','dc1':'3'};","handlingStrategy":"validation","validationCode":"// Validate strategy options before issuing CREATE/ALTER KEYSPACE\nMap<String,String> opts = replication;\nString rf = opts.get(\"replication_factor\");\nif (rf != null && !rf.matches(\"\\\\d+(/\\\\d+)?\")) throw new IllegalArgumentException(\"Bad RF: \" + rf);","typeGuard":null,"tryCatchPattern":"try {\n    session.execute(\"CREATE KEYSPACE ks WITH replication = ?\", replicationMap);\n} catch (ConfigurationException e) {\n    // message contains the constructor's complaint about the offending option\n    logger.error(\"Invalid replication options: {}\", e.getMessage());\n}","preventionTips":["Use only numeric (or 'N/short') replication factor values","Keep per-DC names exactly matching those in the snitch topology","Validate keyspace DDL on a test cluster before production","Generate replication maps from checked templates, not string concatenation"],"tags":["configuration","replication","validation"],"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"}