prestodb/presto · error · IllegalArgumentException

min-input-files must be a valid integer, got: %s

Error message

min-input-files must be a valid integer, got: %s

What it means

The min-input-files option value must parse as an int; when Integer.parseInt throws NumberFormatException, the parser rethrows IllegalArgumentException with this message wrapping the original exception. The raw, unparseable user string is interpolated into the message.

Source

Thrown at presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergUtil.java:1791

     * @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
     */
    public static long parseMinFileSize(Map<String, String> options)
    {
        String minFileSizeStr = options.get("min-file-size-bytes");
        if (minFileSizeStr == null) {
            return 0;
        }

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Provide a plain base-10 integer string, e.g. '10'.
  2. Normalize the value before calling: strip whitespace and cast/round in client code.
  3. If a fraction is intended, use min-file-size-bytes style options or round to an integer explicitly.

Example fix

// before
CALL system.optimize('db.t', map(ARRAY['min_input_files'], ARRAY['1.5']));
// after
CALL system.optimize('db.t', map(ARRAY['min_input_files'], ARRAY['2']));
Defensive patterns

Strategy: validation

Validate before calling

String v = raw.trim();
if (!v.matches("\\d+")) throw new IllegalArgumentException("min-input-files must be a plain integer");

Prevention

When it happens

Trigger: Calling the optimize/rewrite procedure with min-input-files set to non-numeric text, e.g. 'ten', '1.5', '1_000', '1e3', or a value with stray whitespace/quotes.

Common situations: Passing a double like 1.5 from scripting glue; decimal separators from locale settings; quoting mistakes that include quotes inside the value; templating that left a placeholder unresolved.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/325191abba100e21. Report an issue: GitHub.