apache/druid · error · IllegalArgumentException
Invalid format of number: number is blank
Error message
Invalid format of number: number is blank
What it means
HumanReadableBytes.parse is a size-string validation helper: after the null check, it trims the string and rejects an empty/whitespace-only input with this IAE. A byte-size config value like '100MiB' was expected, but a blank string was supplied, typically from an empty property or environment substitution.
Source
Thrown at processing/src/main/java/org/apache/druid/java/util/common/HumanReadableBytes.java:98
public static HumanReadableBytes valueOf(int bytes)
{
return new HumanReadableBytes(bytes);
}
public static HumanReadableBytes valueOf(long bytes)
{
return new HumanReadableBytes(bytes);
}
public static long parse(String number)
{
if (number == null) {
throw new IAE("Invalid format of number: number is null");
}
number = number.trim();
if (number.length() == 0) {
throw new IAE("Invalid format of number: number is blank");
}
return parseInner(number);
}
/**
* parse the case-insensitive string number, which is either:
* <p>
* a number string
* <p>
* or
* <p>
* a number string with a suffix which indicates the unit the of number
* the unit must be one of following
* k - kilobyte = 1000
* m - megabyte = 1,000,000
* g - gigabyte = 1,000,000,000
* t - terabyte = 1,000,000,000,000View on GitHub (pinned to 9b90983fd2)
Solutions
- Provide a valid byte-size string (e.g. '512MiB', '1024') instead of the blank value.
- Check config sources: empty environment variables or unset property substitutions often yield ''.
- Use HumanReadableBytes.parse with a default or guard the caller against blank input.
Example fix
// before
long bytes = HumanReadableBytes.parse(System.getenv("BUFFER_SIZE")); // set to ""
// after
String raw = System.getenv("BUFFER_SIZE");
long bytes = (raw == null || raw.trim().isEmpty()) ? HumanReadableBytes.parse("1gb") : HumanReadableBytes.parse(raw); Defensive patterns
Strategy: validation
Validate before calling
if (raw != null && raw.trim().isEmpty()) {
raw = "1gb"; // substitute default for blank
}
long bytes = HumanReadableBytes.parse(raw); Type guard
static boolean isNonBlank(String s) {
return s != null && !s.trim().isEmpty();
} Try / catch
try {
long bytes = HumanReadableBytes.parse(raw);
} catch (IAE e) {
if (e.getMessage().contains("blank")) { bytes = DEFAULT_BYTES; }
else throw e;
} Prevention
- Check that env vars and properties keys have actual values, not just presence
- Trim user/UI input before storing size configuration
- Reject blank size fields at config-validation time with the property name
- Provide explicit defaults in properties files rather than empty values
When it happens
Trigger: Calling HumanReadableBytes.parse("") or parse(" ") — commonly from an environment variable or properties file where the key exists but its value is blank.
Common situations: Empty value in runtime.properties or an unset-but-present env var; a UI submitting an empty size field; trimming logic leaving an empty string before parsing.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- Metric [%s] not whitelisted.
- Invalid format of number: number is null
- Invalid format of number: %s. Negative value is not allowed.
- Invalid format of number: %s
- Invalid format of number [%s]. The unit should be one of Pi/
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/906112f36e1f53e8.
Report an issue: GitHub.