{"record":{"id":"6fbbea320012573c","repo":"apache/cassandra","slug":"invalid-value-for-system-property-expected-size-i","errorCode":null,"errorMessage":"Invalid value for system property: expected size in bytes with unit but got '%s'","messagePattern":"Invalid value for system property: expected size in bytes with unit but got '(.+?)'","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/config/CassandraRelevantProperties.java","lineNumber":1137,"sourceCode":"        {\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 ->\n    {\n        try\n        {\n            return Double.parseDouble(value);\n        }\n        catch (NumberFormatException e)\n        {\n            throw new ConfigurationException(String.format(\"Invalid value for system property: \" +\n                                                           \"expected floating point value but got '%s'\", value));\n        }\n    };\n\n    /**","sourceCodeStart":1119,"sourceCodeEnd":1155,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/CassandraRelevantProperties.java#L1119-L1155","documentation":"Cassandra system properties that map to byte-size values are parsed by a converter that calls FBUtilities.parseHumanReadableBytes. When the property value cannot be parsed as a human-readable byte size (e.g. '4GiB', '64m'), a ConfigurationException is thrown wrapping the original message and the offending value. It is raised at class-init/property-read time, so it typically fails fast at startup.","triggerScenarios":"Setting a Cassandra relevant system property (via -D JVM flags or System.setProperty) whose converter is BYTES_CONVERTER to a value without a recognized size unit or with garbage characters, e.g. -Dcassandra....=1024xyz or =64 gb with a space/typo.","commonSituations":"Hand-edited jvm-server.options or cassandra-env.sh entries; typos in unit suffixes (missing 'B', wrong case rules); copy-pasting values from docs of other tools that accept bare numbers or different unit spellings; setting the property in an environment where another agent appends stray whitespace.","solutions":["Correct the system property value to a valid human-readable byte size with unit, e.g. 64MiB, 512MiB, 2GiB","Check the full ConfigurationException message (the '%s' suffix includes the underlying parse error) for the exact parse failure","Search jvm*.options, cassandra-env.sh and CASSANDRA_* env var exports for the property and fix the typo","If a bare number was intended as bytes, append an explicit unit such as B (e.g. 1024B) if the parser accepts it"],"exampleFix":"// before\nJVM_OPTS=\"$JVM_OPTS -Dcassandra.available_processors=16gb\"\n// after\nJVM_OPTS=\"$JVM_OPTS -Dcassandra.request_timeout=16000ms\"\n// or for a bytes-valued property:\n// before: -Dsome.bytes.prop=64g\n// after:  -Dsome.bytes.prop=64GiB","handlingStrategy":"validation","validationCode":"String v = System.getProperty(\"my.bytes.prop\", \"\");\nif (!v.matches(\"\\\\d+(B|KB|KiB|MB|MiB|GB|GiB|TB|TiB)\"))\n    throw new IllegalArgumentException(\"Property my.bytes.prop must be a size with unit, got: \" + v);","typeGuard":null,"tryCatchPattern":"try {\n    prop.getString();\n} catch (ConfigurationException e) {\n    logger.error(\"Bad system property value, using default\", e);\n    value = DEFAULT_BYTES;\n}","preventionTips":["Always include a binary unit suffix (MiB, GiB) in byte-size system properties","Keep unit spellings consistent with FBUtilities.parseHumanReadableBytes' accepted forms","Validate jvm options files after edits before restart"],"tags":["configuration","system-properties","startup"],"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"}