{"record":{"id":"bcfd226266b2ab07","repo":"apache/cassandra","slug":"invalid-value-s-for-caching-sub-option-s-on-bcfd22","errorCode":null,"errorMessage":"Invalid value '%s' for caching sub-option '%s': only '%s', '%s', and integer values are allowed","messagePattern":"Invalid value '(.+?)' for caching sub-option '(.+?)': only '(.+?)', '(.+?)', and integer values are allowed","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/schema/CachingParams.java","lineNumber":153,"sourceCode":"    }\n\n    String keysAsString()\n    {\n        return cacheKeys ? ALL : NONE;\n    }\n\n    private static int rowsPerPartitionFromString(String value)\n    {\n        if (value.equalsIgnoreCase(ALL))\n            return Integer.MAX_VALUE;\n\n        if (value.equalsIgnoreCase(NONE))\n            return 0;\n\n        if (StringUtils.isNumeric(value))\n            return Integer.parseInt(value);\n\n        throw new ConfigurationException(format(\"Invalid value '%s' for caching sub-option '%s':\"\n                                                + \" only '%s', '%s', and integer values are allowed\",\n                                                value,\n                                                Option.ROWS_PER_PARTITION,\n                                                ALL,\n                                                NONE));\n    }\n\n    String rowsPerPartitionAsString()\n    {\n        if (rowsPerPartitionToCache == 0)\n            return NONE;\n        else if (rowsPerPartitionToCache == Integer.MAX_VALUE)\n            return ALL;\n        else\n            return Integer.toString(rowsPerPartitionToCache);\n    }\n\n    @Override","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/schema/CachingParams.java#L135-L171","documentation":"The 'rows_per_partition' caching sub-option accepts only 'ALL', 'NONE', or a plain integer. rowsPerPartitionFromString throws ConfigurationException for any other value while parsing the option during schema statements.","triggerScenarios":"CREATE TABLE ... WITH caching = {'rows_per_partition': 'auto'} or {'rows_per_partition': '10.5'} or {'rows_per_partition': '100 rows'} — anything that is not ALL, NONE, or a numeric string.","commonSituations":"Using descriptive words instead of numbers (e.g. 'default'), floating-point counts, or values with units; confusion with pre-3.0 caching option names like 'rows_per_partition_to_cache'.","solutions":["Set rows_per_partition to 'ALL', 'NONE', or a plain integer like '100'","Remove the sub-option to use the default","Verify the string contains only digits (StringUtils.isNumeric is used)"],"exampleFix":"// before\ncaching = {'rows_per_partition': 'auto'}\n// after\ncaching = {'rows_per_partition': '200'}","handlingStrategy":"validation","validationCode":"String v = cachingMap.get(\"rows_per_partition\");\nif (v != null && !(v.equalsIgnoreCase(\"ALL\") || v.equalsIgnoreCase(\"NONE\") || v.matches(\"\\\\d+\"))) throw new IllegalArgumentException(\"rows_per_partition must be ALL, NONE, or an integer\");","typeGuard":"boolean isValidRowsPerPartition(String v) { return \"ALL\".equalsIgnoreCase(v) || \"NONE\".equalsIgnoreCase(v) || v.matches(\"\\\\d+\"); }","tryCatchPattern":"try { session.execute(ddl); } catch (InvalidQueryException e) { if (e.getMessage().contains(\"rows_per_partition\")) { /* correct the value and retry */ } else throw e; }","preventionTips":["Represent row counts as integers in config, stringify only at DDL generation","Reject floats/units in config parsing before they reach DDL","Test generated DDL against a scratch keyspace in CI"],"tags":["cassandra","schema","configuration"],"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"}