apache/cassandra · error · ConfigurationException

Invalid value for system propery '%s': expected one of %s (c

Error message

Invalid value for system propery '%s': expected one of %s (case-insensitive) but was '%s'

What it means

Thrown by CassandraRelevantProperties.getEnum when a system property's value is not a constant of the requested enum class. The invalid value is reported along with all accepted constants; parsing is case-insensitive when toUppercase is enabled. (Note the message contains a typo: 'propery'.)

Source

Thrown at src/java/org/apache/cassandra/config/CassandraRelevantProperties.java:1079

    /**
     * Gets the value of a system property as an enum, optionally calling {@link org.apache.cassandra.utils.LocalizeString#toLowerCaseLocalized(String)} first.
     * If the value is missing, the default value for this property is used
     *
     * @param toUppercase before converting to enum
     * @param enumClass enumeration class
     * @param <T> type
     * @return enum value
     */
    public <T extends Enum<T>> T getEnum(boolean toUppercase, Class<T> enumClass)
    {
        String value = System.getProperty(key, defaultVal);
        try
        {
            return Enum.valueOf(enumClass, toUppercase ? toUpperCaseLocalized(value) : value);
        }
        catch (IllegalArgumentException e)
        {
            throw new ConfigurationException(String.format("Invalid value for system propery '%s': " +
                                                           "expected one of %s (case-insensitive) but was '%s'",
                                                           key, Arrays.toString(enumClass.getEnumConstants()), value));
        }
    }

    /**
     * Sets the value into system properties.
     * @param value to set
     */
    public void setEnum(Enum<?> value)
    {
        System.setProperty(key, value.name());
    }

    public interface PropertyConverter<T>
    {
        T convert(String value);
    }

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Set the property to one of the constants listed in the exception message
  2. Match the expected case (or rely on case-insensitive parsing)
  3. Verify the enum constant exists in your Cassandra version
  4. Validate the value at deploy time before starting the JVM

Example fix

// before
-Dcassandra.disk_failure_policy=stop_all
// after
-Dcassandra.disk_failure_policy=stop
Defensive patterns

Strategy: validation

Validate before calling

String v = System.getProperty("cassandra.disk_failure_policy");
Set<String> valid = Arrays.stream(DiskFailurePolicy.values()).map(Enum::name)
    .collect(Collectors.toSet());
if (v != null && !valid.contains(v.toUpperCase(Locale.ROOT)))
    throw new IllegalArgumentException("Bad property value: " + v);

Try / catch

try {
    policy = CassandraRelevantProperties.DISK_FAILURE_POLICY.getEnum(DiskFailurePolicy.class);
} catch (ConfigurationException e) {
    logger.error("Invalid -D value", e);
    policy = DiskFailurePolicy.DEFAULT;
}

Prevention

When it happens

Trigger: Setting -Dproperty=value where value is not an enum constant, e.g. misspelled consistency levels, disc policy names, or values from a different Cassandra version.

Common situations: cassandra-env.sh or JVM_OPTS with typos, automated deployments templating property values incorrectly, documentation drift between versions.

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