apache/cassandra · error · ConfigurationException

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

Error message

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

What it means

Thrown as a ConfigurationException when the log_all option is not the literal 'true' or 'false'. log_all controls whether every tombstone compaction is logged, and validateOptions enforces strict boolean literals.

Source

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

            catch (NumberFormatException e)
            {
                throw new ConfigurationException(String.format("%s is not a parsable int (base10) for %s", interval, TOMBSTONE_COMPACTION_INTERVAL_OPTION), e);
            }
        }

        String unchecked = options.get(UNCHECKED_TOMBSTONE_COMPACTION_OPTION);
        if (unchecked != null)
        {
            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);

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Set log_all to 'true' or 'false' exactly.
  2. Remove the option to use the default.
  3. Trim the value and re-run the schema change.

Example fix

// before
{'log_all': '1'}
// after
{'log_all': 'false'}
Defensive patterns

Strategy: validation

Validate before calling

String v = options.get("log_all");
if (v != null && !v.equalsIgnoreCase("true") && !v.equalsIgnoreCase("false")) throw new IllegalArgumentException("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 compaction option {'log_all': '1'} or {'log_all': 'TRUE '} with stray characters — anything not equalIgnoreCase to true/false.

Common situations: Using numeric booleans from JSON configs, whitespace or quotes leaking into the option value from shell/cqlsh escaping.

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/c4c08063da06066f. Report an issue: GitHub.