prestodb/presto · error · IllegalArgumentException

min-file-size-bytes must be non-negative, got: %s

Error message

min-file-size-bytes must be non-negative, got: %s

What it means

The min-file-size-bytes optimize option filters partitions whose files are smaller than the given size; a negative byte size is nonsensical, so the parser throws IllegalArgumentException via String.format with the offending value. Null means 'unset' and returns 0.

Source

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

    /**
     * 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;
        }
        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)
    {

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Pass a non-negative value (0 disables the size filter).
  2. Omit the option entirely to use the default (0).
  3. Clamp in generating code: Math.max(0, configuredBytes).

Example fix

// before
CALL system.optimize('db.t', map(ARRAY['min_file_size_bytes'], ARRAY['-1048576']));
// after
CALL system.optimize('db.t', map(ARRAY['min_file_size_bytes'], ARRAY['1048576']));
Defensive patterns

Strategy: validation

Validate before calling

long minFileSize = Long.parseLong(raw);
if (minFileSize < 0) throw new IllegalArgumentException("min-file-size-bytes must be >= 0");

Prevention

When it happens

Trigger: Calling the optimize/rewrite procedure with min-file-size-bytes='-1' or any negative long.

Common situations: Arithmetic in configuration code producing negative sizes; sign typos; trying to express 'disable the filter' with a negative number instead of omitting the option or using 0.

Related errors


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