{"record":{"id":"40842c3538be0c3e","repo":"apache/cassandra","slug":"invalid-value-for-system-property-expected-intege","errorCode":null,"errorMessage":"Invalid value for system property: expected integer value but got '%s'","messagePattern":"Invalid value for system property: expected integer value but got '(.+?)'","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/config/CassandraRelevantProperties.java","lineNumber":1111,"sourceCode":"\n    public interface PropertyConverter<T>\n    {\n        T convert(String value);\n    }\n\n    private static final PropertyConverter<String> STRING_CONVERTER = value -> value;\n\n    private static final PropertyConverter<Boolean> BOOLEAN_CONVERTER = Boolean::parseBoolean;\n\n    private static final PropertyConverter<Integer> INTEGER_CONVERTER = value ->\n    {\n        try\n        {\n            return Integer.decode(value);\n        }\n        catch (NumberFormatException e)\n        {\n            throw new ConfigurationException(String.format(\"Invalid value for system property: \" +\n                                                           \"expected integer value but got '%s'\", value));\n        }\n    };\n\n    private static final PropertyConverter<Long> LONG_CONVERTER = value ->\n    {\n        try\n        {\n            return Long.decode(value);\n        }\n        catch (NumberFormatException e)\n        {\n            throw new ConfigurationException(String.format(\"Invalid value for system property: \" +\n                                                           \"expected long value but got '%s'\", value));\n        }\n    };\n\n    private static final PropertyConverter<Long> SIZE_IN_BYTES_CONVERTER = value ->","sourceCodeStart":1093,"sourceCodeEnd":1129,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/CassandraRelevantProperties.java#L1093-L1129","documentation":"Thrown by the INTEGER_CONVERTER used by CassandraRelevantProperties int getters when the property value cannot be decoded as an integer via Integer.decode. It surfaces as a ConfigurationException identifying the offending value.","triggerScenarios":"Setting a system property read as an int to a non-integer string, e.g. -Dcassandra.some_int=1024MiB or 'abc', or a value outside int range.","commonSituations":"Copy-pasting size-style values into integer properties, quoting errors in cassandra-env.sh leaving stray characters, unit conversions confusion between raw ints and size strings.","solutions":["Set the property to a plain integer value (optionally 0x hex / 0 octal per Integer.decode)","Use a size-aware property/getter (getSizeInBytes) if the value should support MiB/GB suffixes","Check the value for stray whitespace or quotes in your scripts","Catch ConfigurationException at startup to fail fast with a clear message"],"exampleFix":"// before\n-Dcassandra.num_tokens=16,2\n// after\n-Dcassandra.num_tokens=16","handlingStrategy":"validation","validationCode":"String v = System.getProperty(\"cassandra.some_int\");\nif (v != null) {\n    try { Integer.decode(v.trim()); }\n    catch (NumberFormatException e) { throw new IllegalArgumentException(\"Not an int: \" + v); }\n}","typeGuard":null,"tryCatchPattern":"try {\n    int v = CassandraRelevantProperties.SOME_INT.getInt();\n} catch (ConfigurationException e) {\n    int v = 16; // fallback\n}","preventionTips":["Use plain integer literals for int properties","Use size-aware getters for MiB/GB suffixed values","Trim and unquote values generated by templating tools"],"tags":["configuration","system-properties","parsing"],"backgroundTag":"invalid-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"}