{"record":{"id":"b2099ac8f9e5a195","repo":"apache/cassandra","slug":"invalid-value-for-system-property-expected-long-v","errorCode":null,"errorMessage":"Invalid value for system property: expected long value but got '%s'","messagePattern":"Invalid value for system property: expected long value but got '(.+?)'","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/config/CassandraRelevantProperties.java","lineNumber":1124,"sourceCode":"        {\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 ->\n    {\n        try\n        {\n            return FBUtilities.parseHumanReadableBytes(value);\n        }\n        catch (ConfigurationException e)\n        {\n            throw new ConfigurationException(String.format(\"Invalid value for system property: \" +\n                                                           \"expected size in bytes with unit but got '%s'\\n%s\", value, e));\n        }\n    };\n\n    private static final PropertyConverter<Double> DOUBLE_CONVERTER = value ->","sourceCodeStart":1106,"sourceCodeEnd":1142,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/CassandraRelevantProperties.java#L1106-L1142","documentation":"Thrown by the LONG_CONVERTER used by CassandraRelevantProperties long getters when the property value cannot be decoded as a long via Long.decode, surfaced as a ConfigurationException with the bad value in the message.","triggerScenarios":"Setting a long-typed system property to a non-numeric or overflowing string, e.g. -Dcassandra.some_long=8E or '1,000,000'.","commonSituations":"Locale-formatted numbers with separators, time/size suffixes placed on a raw long property, malformed values from templated config management.","solutions":["Set the property to a plain long literal (hex/octal allowed via Long.decode)","Use getSizeInBytes or duration-aware getters for suffixed values","Strip whitespace/separators from the value in your config tooling","Catch ConfigurationException and log the offending property value"],"exampleFix":"// before\n-Dcassandra.gc_warn_threshold_in_ms=1,000\n// after\n-Dcassandra.gc_warn_threshold_in_ms=1000","handlingStrategy":"validation","validationCode":"String v = System.getProperty(\"cassandra.gc_warn_threshold_in_ms\");\nif (v != null) {\n    try { Long.decode(v.trim()); }\n    catch (NumberFormatException e) { throw new IllegalArgumentException(\"Not a long: \" + v); }\n}","typeGuard":null,"tryCatchPattern":"try {\n    long v = CassandraRelevantProperties.SOME_LONG.getLong();\n} catch (ConfigurationException e) {\n    long v = 1000L;\n}","preventionTips":["Avoid thousands separators and suffixes in long properties","Use getSizeInBytes/duration getters when units are needed","Validate generated config values in CI before deployment"],"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"}