prestodb/presto · error · IllegalArgumentException

iceberg.target-max-file-size must be at least 1 byte

Error message

iceberg.target-max-file-size must be at least 1 byte

What it means

A configuration validation error thrown by IcebergConfig.setTargetMaxFileSize when the value of iceberg.target-max-file-size is less than 1 byte. The setter enforces a @Min(1) constraint and an explicit byte check so the writer always has a positive file-size target.

Source

Thrown at presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergConfig.java:592

    public IcebergConfig setAggregatePushDownEnabled(boolean aggregatePushDownEnabled)
    {
        this.aggregatePushDownEnabled = aggregatePushDownEnabled;
        return this;
    }

    @NotNull
    public DataSize getTargetMaxFileSize()
    {
        return targetMaxFileSize;
    }

    @Min(1)
    @Config("iceberg.target-max-file-size")
    @ConfigDescription("Target maximum size of written files; the actual size may be larger")
    public IcebergConfig setTargetMaxFileSize(DataSize targetMaxFileSize)
    {
        if (targetMaxFileSize.toBytes() < 1) {
            throw new IllegalArgumentException("iceberg.target-max-file-size must be at least 1 byte");
        }
        this.targetMaxFileSize = targetMaxFileSize;
        return this;
    }
}

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Set iceberg.target-max-file-size to a positive value, e.g. iceberg.target-max-file-size=512MB
  2. Check config templating so the placeholder resolves to a real positive size rather than 0
  3. If programmatic, call setTargetMaxFileSize(new DataSize(...)) with a value >= 1 byte

Example fix

// before
iceberg.target-max-file-size=0B
// after
iceberg.target-max-file-size=512MB
Defensive patterns

Strategy: validation

Validate before calling

DataSize size = DataSize.valueOf(configValue);
if (size.toBytes() < 1) throw new IllegalArgumentException("iceberg.target-max-file-size must be >= 1 byte");

Try / catch

try { config.setTargetMaxFileSize(size); } catch (IllegalArgumentException e) { /* fall back to a sane default like DataSize.succinctDataSize(512, MEGABYTE) */ }

Prevention

When it happens

Trigger: Setting iceberg.target-max-file-size=0B, a sub-byte unit, or otherwise non-positive DataSize in connector properties or config; also triggered programmatically when calling setTargetMaxFileSize with such a value.

Common situations: Typos in properties files (0B, -1), templated config with an unset/zero variable, or test code constructing IcebergConfig with invalid sizes.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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