{"record":{"id":"0373fb85d001afba","repo":"apache/cassandra","slug":"invalid-caching-sub-options-s-only-s-and-s","errorCode":null,"errorMessage":"Invalid caching sub-options %s: only '%s' and '%s' are allowed","messagePattern":"Invalid caching sub-options (.+?): only '(.+?)' and '(.+?)' are allowed","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/schema/CachingParams.java","lineNumber":105,"sourceCode":"    {\n        return rowsPerPartitionToCache;\n    }\n\n    public static CachingParams fromMap(Map<String, String> map)\n    {\n        Map<String, String> copy = new HashMap<>(map);\n\n        String keys = copy.remove(Option.KEYS.toString());\n        boolean cacheKeys = keys != null && keysFromString(keys);\n\n        String rows = copy.remove(Option.ROWS_PER_PARTITION.toString());\n        int rowsPerPartitionToCache = rows == null\n                                    ? 0\n                                    : rowsPerPartitionFromString(rows);\n\n        if (!copy.isEmpty())\n        {\n            throw new ConfigurationException(format(\"Invalid caching sub-options %s: only '%s' and '%s' are allowed\",\n                                                    copy.keySet(),\n                                                    Option.KEYS,\n                                                    Option.ROWS_PER_PARTITION));\n        }\n\n        return new CachingParams(cacheKeys, rowsPerPartitionToCache);\n    }\n\n    public Map<String, String> asMap()\n    {\n        return ImmutableMap.of(Option.KEYS.toString(),\n                               keysAsString(),\n                               Option.ROWS_PER_PARTITION.toString(),\n                               rowsPerPartitionAsString());\n    }\n\n    private static boolean keysFromString(String value)\n    {","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/schema/CachingParams.java#L87-L123","documentation":"CachingParams.fromMap() parses the 'caching' table option map. After extracting the recognized sub-options ('keys' and 'rows_per_partition'), any leftover entries cause a ConfigurationException listing the offending keys, because caching accepts only those two sub-options.","triggerScenarios":"CREATE/ALTER TABLE with caching = {'enabled': true} or {'all': ...} or any key other than 'keys'/'rows_per_partition', e.g. caching = {'keys': 'ALL', 'rows': 'NONE'} ('rows' instead of 'rows_per_partition').","commonSituations":"Migrating configs from older Cassandra versions or translating from other systems; misspelling 'rows_per_partition'; assuming an 'enabled' toggle exists in the modern map-style syntax.","solutions":["Use only 'keys' and 'rows_per_partition' keys in the caching map","Replace misspelled keys (e.g. 'rows' -> 'rows_per_partition')","Use the shorthand form caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'} exactly"],"exampleFix":"// before\ncaching = {'enabled': true}\n// after\ncaching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}","handlingStrategy":"validation","validationCode":"java.util.Set<String> allowed = java.util.Set.of(\"keys\", \"rows_per_partition\");\nif (!allowed.containsAll(cachingMap.keySet())) throw new IllegalArgumentException(\"Unknown caching keys: \" + cachingMap.keySet());","typeGuard":null,"tryCatchPattern":"try { session.execute(ddl); } catch (InvalidQueryException e) { if (e.getMessage().contains(\"Invalid caching sub-options\")) { /* strip unknown keys and retry */ } else throw e; }","preventionTips":["Only ever emit caching = {'keys': ..., 'rows_per_partition': ...} from schema tooling","Compare option maps against the current version's documented option set during upgrades","Write schema DDL templates rather than free-form maps"],"tags":["cassandra","schema","configuration"],"backgroundTag":"unsupported-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"}