apache/cassandra · error · java.lang.IllegalArgumentException

Could not set new local compaction strategy: <cause message>

Error message

Could not set new local compaction strategy: <cause message>

What it means

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.

Source

Thrown at src/java/org/apache/cassandra/db/ColumnFamilyStore.java:448

    public String getCompactionParametersJson()
    {
        return JsonUtils.writeAsJsonString(getCompactionParameters());
    }

    public void setCompactionParameters(Map<String, String> options)
    {
        try
        {
            CompactionParams compactionParams = CompactionParams.fromMap(options);
            compactionParams.validate();
            compactionStrategyManager.overrideLocalParams(compactionParams);
        }
        catch (Throwable t)
        {
            logger.error("Could not set new local compaction strategy", t);
            // dont propagate the ConfigurationException over jmx, user will only see a ClassNotFoundException
            throw new IllegalArgumentException("Could not set new local compaction strategy: "+t.getMessage());
        }
    }

    public void setCompactionParametersJson(String options)
    {
        setCompactionParameters(JsonUtils.fromJsonMap(options));
    }

    public Map<String,String> getCompressionParameters()
    {
        return metadata.getLocal().params.compression.asMap();
    }

    public String getCompressionParametersJson()
    {
        return JsonUtils.writeAsJsonString(getCompressionParameters());
    }

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Check the server log for the full 'Could not set new local compaction strategy' stack trace to see the underlying cause
  2. Correct the compaction strategy class name (use fully qualified names for third-party strategies) and ensure the jar is on the classpath
  3. Fix option key/value names to match the strategy's supported options
  4. Retry nodetool setcompactionparameters with corrected options

Example fix

// before
nodetool setcompactionparameters ks t '{"class":"SizeTieredCompactionStrategi","options":{"min_threshold":"4"}}'
// after
nodetool setcompactionparameters ks t '{"class":"SizeTieredCompactionStrategy","options":{"min_threshold":"4"}}'
Defensive patterns

Strategy: try-catch

Validate before calling

// verify class loadability before calling
try { Class.forName("org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy"); } catch (ClassNotFoundException e) { /* bad strategy class */ }

Try / catch

try { cfs.setCompactionParameters(params); } catch (IllegalArgumentException e) { logger.error("bad compaction params: {}", e.getMessage()); /* read server log for root ConfigurationException */ }

Prevention

When it happens

Trigger: nodetool setcompactionparameters or JMX setCompactionParameters (and tests calling it) with a bad compaction class name, unknown option keys, or values the strategy rejects.

Common situations: 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.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/ea0b4ce892de9fcd. Report an issue: GitHub.