{"record":{"id":"74c65d06f0f48b70","repo":"apache/cassandra","slug":"invalid-value-for-system-propery-s-expected-on","errorCode":null,"errorMessage":"Invalid value for system propery '%s': expected one of %s (case-insensitive) but was '%s'","messagePattern":"Invalid value for system propery '(.+?)': expected one of (.+?) \\(case-insensitive\\) but was '(.+?)'","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/config/CassandraRelevantProperties.java","lineNumber":1079,"sourceCode":"    /**\n     * Gets the value of a system property as an enum, optionally calling {@link org.apache.cassandra.utils.LocalizeString#toLowerCaseLocalized(String)} first.\n     * If the value is missing, the default value for this property is used\n     *\n     * @param toUppercase before converting to enum\n     * @param enumClass enumeration class\n     * @param <T> type\n     * @return enum value\n     */\n    public <T extends Enum<T>> T getEnum(boolean toUppercase, Class<T> enumClass)\n    {\n        String value = System.getProperty(key, defaultVal);\n        try\n        {\n            return Enum.valueOf(enumClass, toUppercase ? toUpperCaseLocalized(value) : value);\n        }\n        catch (IllegalArgumentException e)\n        {\n            throw new ConfigurationException(String.format(\"Invalid value for system propery '%s': \" +\n                                                           \"expected one of %s (case-insensitive) but was '%s'\",\n                                                           key, Arrays.toString(enumClass.getEnumConstants()), value));\n        }\n    }\n\n    /**\n     * Sets the value into system properties.\n     * @param value to set\n     */\n    public void setEnum(Enum<?> value)\n    {\n        System.setProperty(key, value.name());\n    }\n\n    public interface PropertyConverter<T>\n    {\n        T convert(String value);\n    }","sourceCodeStart":1061,"sourceCodeEnd":1097,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/CassandraRelevantProperties.java#L1061-L1097","documentation":"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'.)","triggerScenarios":"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.","commonSituations":"cassandra-env.sh or JVM_OPTS with typos, automated deployments templating property values incorrectly, documentation drift between versions.","solutions":["Set the property to one of the constants listed in the exception message","Match the expected case (or rely on case-insensitive parsing)","Verify the enum constant exists in your Cassandra version","Validate the value at deploy time before starting the JVM"],"exampleFix":"// before\n-Dcassandra.disk_failure_policy=stop_all\n// after\n-Dcassandra.disk_failure_policy=stop","handlingStrategy":"validation","validationCode":"String v = System.getProperty(\"cassandra.disk_failure_policy\");\nSet<String> valid = Arrays.stream(DiskFailurePolicy.values()).map(Enum::name)\n    .collect(Collectors.toSet());\nif (v != null && !valid.contains(v.toUpperCase(Locale.ROOT)))\n    throw new IllegalArgumentException(\"Bad property value: \" + v);","typeGuard":null,"tryCatchPattern":"try {\n    policy = CassandraRelevantProperties.DISK_FAILURE_POLICY.getEnum(DiskFailurePolicy.class);\n} catch (ConfigurationException e) {\n    logger.error(\"Invalid -D value\", e);\n    policy = DiskFailurePolicy.DEFAULT;\n}","preventionTips":["Lint JVM -D values in config management before launch","Copy enum names from the version's source/docs","Rely on case-insensitive parsing but avoid ambiguous spellings"],"tags":["configuration","system-properties","enum"],"backgroundTag":"invalid-enum-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"}