prestodb/presto · error · IllegalArgumentException
min-input-files must be at least 1, got: %s
Error message
min-input-files must be at least 1, got: %s
What it means
The Iceberg rewrite-files / optimize option min-input-files accepts a string that is parsed to an int; values below 1 are meaningless (a partition must contain at least one file to be a rewrite candidate), so the parser throws IllegalArgumentException via String.format. The message interpolates the offending raw value.
Source
Thrown at presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergUtil.java:1785
}
/**
* Parses and validates the min-input-files option value.
* Returns the parsed integer value, or default of {@value #DEFAULT_MIN_INPUT_FILES} if the option is not present.
*
* @throws IllegalArgumentException if the value is invalid
*/
public static int parseMinInputFiles(Map<String, String> options)
{
String minInputFilesStr = options.get("min-input-files");
if (minInputFilesStr == null) {
return DEFAULT_MIN_INPUT_FILES;
}
try {
int minInputFiles = Integer.parseInt(minInputFilesStr);
if (minInputFiles < 1) {
throw new IllegalArgumentException(
String.format("min-input-files must be at least 1, got: %s", minInputFiles));
}
return minInputFiles;
}
catch (NumberFormatException e) {
throw new IllegalArgumentException(
String.format("min-input-files must be a valid integer, got: %s", minInputFilesStr), e);
}
}
/**
* Parses and validates the min-file-size-bytes option value.
* Returns the parsed long value, or 0 if the option is not present.
*
* @param options rewrite options map
* @return minimum file size threshold in bytes
* @throws IllegalArgumentException if the value is invalid
*/View on GitHub (pinned to 55bb57d202)
Solutions
- Pass min-input-files = 1 or greater (default used when unset).
- Omit the option entirely to fall back to DEFAULT_MIN_INPUT_FILES instead of forcing 0.
- Clamp the value in generating code: Math.max(1, configuredValue).
Example fix
// before
CALL system.optimize('db.t', map(ARRAY['min_input_files'], ARRAY['0']));
// after
CALL system.optimize('db.t', map(ARRAY['min_input_files'], ARRAY['1'])); Defensive patterns
Strategy: validation
Validate before calling
int minInputFiles = Integer.parseInt(raw);
if (minInputFiles < 1) throw new IllegalArgumentException("min-input-files must be >= 1"); Prevention
- Omit the option rather than passing 0 to mean 'default'.
- Clamp configured values with Math.max(1, value) at config-load time.
- Document valid ranges next to procedure call sites in team runbooks.
When it happens
Trigger: Calling the Iceberg optimizer/system procedure with option min-input-files='0', '-5', or any integer less than 1.
Common situations: Hand-tuning optimize procedure arguments and mistakenly passing 0 thinking it disables the threshold; copy-paste defaults; generating options programmatically with an uninitialized counter.
Related errors
- min-file-size-bytes must be non-negative, got: %s
- max-file-size-bytes must be non-negative, got: %s
- min-input-files must be a valid integer, got: %s
- min-file-size-bytes must be a valid long, got: %s
- max-file-size-bytes must be a valid long, got: %s
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/1563194800ca46e7.
Report an issue: GitHub.