prestodb/presto · error · IllegalArgumentException
min-file-size-bytes must be a valid long, got: %s
Error message
min-file-size-bytes must be a valid long, got: %s
What it means
The min-file-size-bytes option must parse as a long; when Long.parseLong throws NumberFormatException it is rethrown as IllegalArgumentException with this message and the raw string interpolated. Null input is handled separately (returns 0), so this only fires on malformed non-null values.
Source
Thrown at presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergUtil.java:1819
* @return minimum file size threshold in bytes
* @throws IllegalArgumentException if the value is invalid
*/
public static long parseMinFileSize(Map<String, String> options)
{
String minFileSizeStr = options.get("min-file-size-bytes");
if (minFileSizeStr == null) {
return 0;
}
try {
long minFileSize = Long.parseLong(minFileSizeStr);
if (minFileSize < 0) {
throw new IllegalArgumentException(
String.format("min-file-size-bytes must be non-negative, got: %s", minFileSize));
}
return minFileSize;
}
catch (NumberFormatException e) {
throw new IllegalArgumentException(
String.format("min-file-size-bytes must be a valid long, got: %s", minFileSizeStr), e);
}
}
/**
* Parses and validates the max-file-size-bytes option value.
* Returns the parsed long value, or 0 if the option is not present.
*
* @throws IllegalArgumentException if the value is invalid
*/
public static long parseMaxFileSize(Map<String, String> options)
{
String maxFileSizeStr = options.get("max-file-size-bytes");
if (maxFileSizeStr == null) {
return 0;
}
try {
long maxFileSize = Long.parseLong(maxFileSizeStr);View on GitHub (pinned to 55bb57d202)
Solutions
- Convert the size to a plain raw byte integer string, e.g. '104857600' for 100MB.
- Do unit conversion in the calling application before building the option map.
- Remove separators/decimals: use Long.toString(longValue).
Example fix
// before
CALL system.optimize('db.t', map(ARRAY['min_file_size_bytes'], ARRAY['100MB']));
// after
CALL system.optimize('db.t', map(ARRAY['min_file_size_bytes'], ARRAY['104857600'])); Defensive patterns
Strategy: validation
Validate before calling
String v = raw.trim();
if (!v.matches("\\d+")) throw new IllegalArgumentException("min-file-size-bytes must be raw bytes, no suffixes");
Long.parseLong(v); Prevention
- Convert units (MB/GB) to raw bytes in application code before building options.
- Never pass human-readable sizes directly; store byte counts in config.
- Round floats to long explicitly before stringifying.
When it happens
Trigger: Calling optimize with min-file-size-bytes like '10MB', '5m', '1048576.0', or any non-integer string — suffixes are not parsed here.
Common situations: Passing human-readable byte sizes ('100MB') instead of raw byte counts; floats from JSON configs; thousands separators like '1,048,576'.
Related errors
- min-input-files must be a valid integer, got: %s
- max-file-size-bytes must be a valid long, got: %s
- min-input-files must be at least 1, got: %s
- min-file-size-bytes must be non-negative, got: %s
- max-file-size-bytes must be non-negative, got: %s
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/f30f2d34c7ba967f.
Report an issue: GitHub.