apache/cassandra · error · ConfigurationException

enabled should either be 'true' or 'false', not %s

Error message

enabled should either be 'true' or 'false', not %s

What it means

Thrown as a ConfigurationException when the compaction 'enabled' option is not the literal 'true' or 'false'. This option toggles whether the compaction strategy schedules background compactions, and its value is validated strictly at configuration time.

Source

Thrown at src/java/org/apache/cassandra/db/compaction/AbstractCompactionStrategy.java:508

            if (!unchecked.equalsIgnoreCase("true") && !unchecked.equalsIgnoreCase("false"))
                throw new ConfigurationException(String.format("'%s' should be either 'true' or 'false', not '%s'", UNCHECKED_TOMBSTONE_COMPACTION_OPTION, unchecked));
        }

        String logAll = options.get(LOG_ALL_OPTION);
        if (logAll != null)
        {
            if (!logAll.equalsIgnoreCase("true") && !logAll.equalsIgnoreCase("false"))
            {
                throw new ConfigurationException(String.format("'%s' should either be 'true' or 'false', not %s", LOG_ALL_OPTION, logAll));
            }
        }

        String compactionEnabled = options.get(COMPACTION_ENABLED);
        if (compactionEnabled != null)
        {
            if (!compactionEnabled.equalsIgnoreCase("true") && !compactionEnabled.equalsIgnoreCase("false"))
            {
                throw new ConfigurationException(String.format("enabled should either be 'true' or 'false', not %s", compactionEnabled));
            }
        }

        Map<String, String> uncheckedOptions = new HashMap<String, String>(options);
        uncheckedOptions.remove(TOMBSTONE_THRESHOLD_OPTION);
        uncheckedOptions.remove(TOMBSTONE_COMPACTION_INTERVAL_OPTION);
        uncheckedOptions.remove(UNCHECKED_TOMBSTONE_COMPACTION_OPTION);
        uncheckedOptions.remove(LOG_ALL_OPTION);
        uncheckedOptions.remove(COMPACTION_ENABLED);
        uncheckedOptions.remove(ONLY_PURGE_REPAIRED_TOMBSTONES);
        uncheckedOptions.remove(CompactionParams.Option.PROVIDE_OVERLAPPING_TOMBSTONES.toString());
        return uncheckedOptions;
    }

    /**
     * Method for grouping similar SSTables together, This will be used by
     * anti-compaction to determine which SSTables should be anitcompacted
     * as a group. If a given compaction strategy creates sstables which

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Set enabled to 'true' or 'false'.
  2. To pause compaction temporarily, use nodetool disableautocompaction instead of misconfiguring the option.
  3. Remove the option to accept the default (enabled).

Example fix

// before
{'class': 'SizeTieredCompactionStrategy', 'enabled': 'no'}
// after
{'class': 'SizeTieredCompactionStrategy', 'enabled': 'false'}
Defensive patterns

Strategy: validation

Validate before calling

String v = options.get("enabled");
if (v != null && !v.equalsIgnoreCase("true") && !v.equalsIgnoreCase("false")) throw new IllegalArgumentException("enabled must be true/false: " + v);

Try / catch

try { session.execute(alterCql); } catch (ConfigurationException e) { /* fix boolean literal and retry */ }

Prevention

When it happens

Trigger: CREATE/ALTER TABLE with {'enabled': 'yes'} or {'enabled': 'on'} in the compaction options map.

Common situations: Copying option values from non-Java configuration formats, automation tools templating booleans as 0/1 or yes/no.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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