prestodb/presto · error · IllegalArgumentException

Value out of bound: %s

Error message

Value out of bound: %s

What it means

Guard in readUnsigned: a little-endian unsigned value read from the variant metadata/value bytes does not fit into a non-negative int (exceeds Integer.MAX_VALUE), or the assembled byte pattern is out of range for the field width. Marks the variant as malformed per the MALFORMED_VARIANT contract.

Source

Thrown at presto-parquet/src/main/java/com/facebook/presto/parquet/spark/VariantUtil.java:174

        long signedByteValue = bytes[position + numBytes - 1];
        result |= signedByteValue << (8 * (numBytes - 1));
        return result;
    }

    // Read a little-endian unsigned int value from `bytes[position, position + numBytes)`. The value must fit
    // into a non-negative int (`[0, Integer.MAX_VALUE]`).
    static int readUnsigned(byte[] bytes, int position, int numBytes)
    {
        checkIndex(position, bytes.length);
        checkIndex(position + numBytes - 1, bytes.length);
        int result = 0;
        // Similar to the `readLong` loop, but all bytes should be unsign-extended.
        for (int i = 0; i < numBytes; ++i) {
            int unsignedByteValue = bytes[position + i] & 0xFF;
            result |= unsignedByteValue << (8 * i);
        }
        if (result < 0) {
            throw new IllegalArgumentException(String.format("Value out of bound: %s", result));
        }
        return result;
    }

    // The value type of variant value. It is determined by the header byte but not a 1:1 mapping
    // (for example, INT1/2/4/8 all maps to `Type.LONG`).
    public enum Type
    {
        NULL,
        BOOLEAN,
        LONG,
        FLOAT,
        DOUBLE,
        DECIMAL,
        STRING,
        BINARY,
        DATE,
        TIMESTAMP,

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Re-ingest the variant data from a trusted source
  2. Add writer-side validation that u32 fields stay within int range
  3. Align writer and reader on the variant encoding version
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-parquet/src/main/java/com/facebook/presto/parquet/spark/VariantUtil.java:174 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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