{"record":{"id":"ea0b4ce892de9fcd","repo":"apache/cassandra","slug":"could-not-set-new-local-compaction-strategy-caus","errorCode":null,"errorMessage":"Could not set new local compaction strategy: <cause message>","messagePattern":"Could not set new local compaction strategy: <cause message>","errorType":"exception","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/ColumnFamilyStore.java","lineNumber":448,"sourceCode":"\n    public String getCompactionParametersJson()\n    {\n        return JsonUtils.writeAsJsonString(getCompactionParameters());\n    }\n\n    public void setCompactionParameters(Map<String, String> options)\n    {\n        try\n        {\n            CompactionParams compactionParams = CompactionParams.fromMap(options);\n            compactionParams.validate();\n            compactionStrategyManager.overrideLocalParams(compactionParams);\n        }\n        catch (Throwable t)\n        {\n            logger.error(\"Could not set new local compaction strategy\", t);\n            // dont propagate the ConfigurationException over jmx, user will only see a ClassNotFoundException\n            throw new IllegalArgumentException(\"Could not set new local compaction strategy: \"+t.getMessage());\n        }\n    }\n\n    public void setCompactionParametersJson(String options)\n    {\n        setCompactionParameters(JsonUtils.fromJsonMap(options));\n    }\n\n    public Map<String,String> getCompressionParameters()\n    {\n        return metadata.getLocal().params.compression.asMap();\n    }\n\n    public String getCompressionParametersJson()\n    {\n        return JsonUtils.writeAsJsonString(getCompressionParameters());\n    }\n","sourceCodeStart":430,"sourceCodeEnd":466,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/ColumnFamilyStore.java#L430-L466","documentation":"setCompactionParameters (JMX/nodetool path) applies new local compaction options via compactionStrategyManager.overrideLocalParams. If that fails - typically a ConfigurationException from instantiating the strategy class or invalid options - the raw cause is logged and rethrown as an IllegalArgumentException, deliberately NOT propagating ConfigurationException over JMX because the user would only see a ClassNotFoundException.","triggerScenarios":"nodetool setcompactionparameters or JMX setCompactionParameters (and tests calling it) with a bad compaction class name, unknown option keys, or values the strategy rejects.","commonSituations":"Typo in the compaction strategy class name (missing package prefix for non-core strategies, third-party jar missing from classpath), option name typos after upgrading, options malformed for the target strategy.","solutions":["Check the server log for the full 'Could not set new local compaction strategy' stack trace to see the underlying cause","Correct the compaction strategy class name (use fully qualified names for third-party strategies) and ensure the jar is on the classpath","Fix option key/value names to match the strategy's supported options","Retry nodetool setcompactionparameters with corrected options"],"exampleFix":"// before\nnodetool setcompactionparameters ks t '{\"class\":\"SizeTieredCompactionStrategi\",\"options\":{\"min_threshold\":\"4\"}}'\n// after\nnodetool setcompactionparameters ks t '{\"class\":\"SizeTieredCompactionStrategy\",\"options\":{\"min_threshold\":\"4\"}}'","handlingStrategy":"try-catch","validationCode":"// verify class loadability before calling\ntry { Class.forName(\"org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy\"); } catch (ClassNotFoundException e) { /* bad strategy class */ }","typeGuard":null,"tryCatchPattern":"try { cfs.setCompactionParameters(params); } catch (IllegalArgumentException e) { logger.error(\"bad compaction params: {}\", e.getMessage()); /* read server log for root ConfigurationException */ }","preventionTips":["Use fully qualified class names for non-default compaction strategies","Validate option keys against the strategy's supported options before applying","Keep third-party strategy jars on every node's classpath"],"tags":["cassandra","compaction","jmx","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"}