apache/cassandra · error · ConfigurationException
is not a valid size in bytes
Error message
%s %s is not a valid size in bytes: %s
What it means
Thrown when the target_sstable_size string cannot be parsed as a number of bytes by FBUtilities.parseHumanReadableBytes; the NumberFormatException is wrapped into a ConfigurationException. The option must be a human-readable byte size like '160MiB' or a plain long byte count.
Solutions
- Provide a valid human-readable size string, e.g. 'target_sstable_size': '160MiB'.
- Use a plain integer byte count if unit suffixes are causing problems.
- Remove the option to fall back to the default target sstable size.
Example fix
// before 'target_sstable_size': '160 MB!' // after 'target_sstable_size': '160MiB'
Defensive patterns
Strategy: validation
Validate before calling
try { FBUtilities.parseHumanReadableBytes(opts.get("target_sstable_size")); } catch (NumberFormatException e) { /* reject before schema change */ } Try / catch
try { alterTable(); } catch (ConfigurationException e) { fixAndRetry(e.getMessage()); } Prevention
- Use only 'NNN unit' literals understood by FBUtilities.parseHumanReadableBytes (e.g. 160MiB)
- Avoid locale-formatted numbers and stray whitespace in config templates
- Test generated configs in a scratch keyspace first
When it happens
Trigger: Controller.validateOptions receives a target_sstable_size value that parseHumanReadableBytes rejects (non-numeric text, malformed unit suffix, empty string), e.g. via CREATE TABLE compaction options or ALTER TABLE.
Common situations: Typos such as '160 MiB' with unexpected characters, '10GBX', locale-formatted numbers ('10,000'), or passing a decimal like '1.5GB' where the parser expects an integer quantity.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- is not a parsable long (base10) for
- concurrent_compactors should be strictly greater than 0…
- Could not set new local compaction strategy
- Disabling compaction by setting compaction thresholds to 0…
- Fan factor cannot be lower than 2 in
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/76835c015a6c4683.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/db/compaction/unified/Controller.java:538
{
double targetSize = FBUtilities.parseHumanReadable(s, null, "B");
if (targetSize >= Long.MAX_VALUE) {
throw new ConfigurationException(String.format("%s %s is out of range of Long.",
TARGET_SSTABLE_SIZE_OPTION,
s));
}
if (targetSize < MIN_TARGET_SSTABLE_SIZE)
{
throw new ConfigurationException(String.format("%s %s is not acceptable, size must be at least %s",
TARGET_SSTABLE_SIZE_OPTION,
s,
FBUtilities.prettyPrintMemory(MIN_TARGET_SSTABLE_SIZE)));
}
targetSSTableSize = (long) Math.ceil(targetSize);
}
catch (NumberFormatException e)
{
throw new ConfigurationException(String.format("%s %s is not a valid size in bytes: %s",
TARGET_SSTABLE_SIZE_OPTION,
s,
e.getMessage()),
e);
}
}
s = options.remove(FLUSH_SIZE_OVERRIDE_OPTION);
if (s != null)
{
try
{
long flushSize = FBUtilities.parseHumanReadableBytes(s);
if (flushSize < MIN_TARGET_SSTABLE_SIZE)
throw new ConfigurationException(String.format("%s %s is not acceptable, size must be at least %s",
FLUSH_SIZE_OVERRIDE_OPTION,
s,
FBUtilities.prettyPrintMemory(MIN_TARGET_SSTABLE_SIZE)));View on GitHub (pinned to 88fd0f6a0e)