{"record":{"id":"cca61bc3e8bec4c8","repo":"apache/cassandra","slug":"missing-property-value-or-default-value-is-not-set","errorCode":null,"errorMessage":"Missing property value or default value is not set: ${key}","messagePattern":"Missing property value or default value is not set: (.+?)","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/config/CassandraRelevantProperties.java","lineNumber":931,"sourceCode":"     * @return System property value if it exists, defaultValue otherwise. Throws an exception if no default value is set.\n     */\n    public int getInt()\n    {\n        String value = System.getProperty(key);\n        if (value == null && defaultVal == null)\n            throw new ConfigurationException(\"Missing property value or default value is not set: \" + key);\n        return INTEGER_CONVERTER.convert(value == null ? defaultVal : value);\n    }\n\n    /**\n     * Gets the value of a system property as a long.\n     * @return System property value if it exists, defaultValue otherwise. Throws an exception if no default value is set.\n     */\n    public long getLong()\n    {\n        String value = System.getProperty(key);\n        if (value == null && defaultVal == null)\n            throw new ConfigurationException(\"Missing property value or default value is not set: \" + key);\n        return LONG_CONVERTER.convert(value == null ? defaultVal : value);\n    }\n\n    /**\n     * Gets the value of a system property as a long.\n     * @return system property long value if it exists, defaultValue otherwise.\n     */\n    public long getLong(long overrideDefaultValue)\n    {\n        String value = System.getProperty(key);\n        if (value == null)\n            return overrideDefaultValue;\n\n        return LONG_CONVERTER.convert(value);\n    }\n\n    /**\n     * Gets the value of a system property as a double.","sourceCodeStart":913,"sourceCodeEnd":949,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/CassandraRelevantProperties.java#L913-L949","documentation":"Thrown by CassandraRelevantProperties.getLong() when a system property has neither a runtime value (System.getProperty returns null) nor a configured default. The property descriptor was declared without a default, so the library refuses to guess a long value.","triggerScenarios":"Calling props.getLong() on a CassandraRelevantProperties entry created without a default and without -Dkey=value set in the JVM.","commonSituations":"Tests or tools reading new tuning properties not set in cassandra-env.sh, code added a property without a default then a caller used the no-default getter, unit tests starting Cassandra in-process with stripped system properties.","solutions":["Set the system property, e.g. -Dcassandra.sometuning=1024","Use getLong(defaultValue) overload instead of the no-arg version","Declare a default value when constructing the CassandraRelevantProperties entry","Check the property's existence with props.isPresent()/System.getProperty(key) before calling"],"exampleFix":"// before\nlong size = CassandraRelevantProperties.SOME_TUNING.getLong();\n// after\nlong size = CassandraRelevantProperties.SOME_TUNING.getLong(1024L);","handlingStrategy":"validation","validationCode":"String raw = System.getProperty(\"cassandra.some_tuning\");\nif (raw == null) throw new IllegalStateException(\"Set -Dcassandra.some_tuning\");","typeGuard":null,"tryCatchPattern":"try {\n    long v = CassandraRelevantProperties.SOME_TUNING.getLong();\n} catch (ConfigurationException e) {\n    long v = 1024L; // explicit fallback\n}","preventionTips":["Prefer getLong(defaultValue) over the no-arg getter","Declare defaults for all property descriptors","Set required -D properties in cassandra-env.sh"],"tags":["configuration","system-properties"],"backgroundTag":"missing-config-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"}