prestodb/presto · error · IllegalArgumentException
max-file-size-bytes must be a valid long, got: %s
Error message
max-file-size-bytes must be a valid long, got: %s
What it means
The max-file-size-bytes option must parse as a long; NumberFormatException from Long.parseLong is rethrown as IllegalArgumentException with this message wrapping the cause, interpolating the raw string. Only non-null malformed values reach this path.
Source
Thrown at presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergUtil.java:1845
*
* @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);
if (maxFileSize < 0) {
throw new IllegalArgumentException(
String.format("max-file-size-bytes must be non-negative, got: %s", maxFileSize));
}
return maxFileSize;
}
catch (NumberFormatException e) {
throw new IllegalArgumentException(
String.format("max-file-size-bytes must be a valid long, got: %s", maxFileSizeStr), e);
}
}
/**
* Parses and validates the rewrite-all option value.
* Returns true if the option is set to "true", false otherwise.
*/
public static boolean parseRewriteAll(Map<String, String> options)
{
String rewriteAllStr = options.get("rewrite-all");
if (rewriteAllStr == null) {
return false;
}
return Boolean.parseBoolean(rewriteAllStr.trim());
}
/**View on GitHub (pinned to 55bb57d202)
Solutions
- Provide a raw integer byte string, e.g. '536870912' for 512MB.
- Parse unit suffixes client-side before constructing the option map.
- Use Long.toString of a long value computed in application code.
Example fix
// before
CALL system.optimize('db.t', map(ARRAY['max_file_size_bytes'], ARRAY['512MB']));
// after
CALL system.optimize('db.t', map(ARRAY['max_file_size_bytes'], ARRAY['536870912'])); Defensive patterns
Strategy: validation
Validate before calling
String v = raw.trim();
if (!v.matches("\\d+")) throw new IllegalArgumentException("max-file-size-bytes must be raw bytes integer");
Long.parseLong(v); Prevention
- Do unit conversion client-side; pass plain integers only.
- Reject scientific notation and thousands separators at config load.
- Centralize option formatting in one utility with tests.
When it happens
Trigger: Calling optimize with max-file-size-bytes like '512MB', '5.0e8', '512_000_000', or other non-integer strings.
Common situations: Human-readable sizes passed verbatim; floats from YAML/JSON config; scientific notation; locale-grouped digits.
Related errors
- min-input-files must be a valid integer, got: %s
- min-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/b0fddf6857b4bf4b.
Report an issue: GitHub.