prestodb/presto · error · IllegalArgumentException

lineLength {lineLength} > 0, but lineSeparator is null

Error message

lineLength {lineLength} > 0, but lineSeparator is null

What it means

Base32(lineLength, lineSeparator, ...) constructor guard: a positive lineLength requests wrapped output lines, but no line separator bytes were supplied, so wrapping is impossible and construction is rejected.

Source

Thrown at presto-common/src/main/java/com/facebook/presto/common/type/encoding/Base32.java:290

     * @param pad byte used as padding byte.
     * @throws IllegalArgumentException The provided lineSeparator included some Base32 characters. That's not going to work! Or the
     * lineLength > 0 and lineSeparator is null.
     */
    public Base32(final int lineLength, final byte[] lineSeparator, final boolean useHex, final byte pad)
    {
        super(BYTES_PER_ENCODED_BLOCK, lineLength,
                lineSeparator == null ? 0 : lineSeparator.length, pad);
        if (useHex) {
            this.encodeTable = HEX_ENCODE_TABLE;
            this.decodeTable = HEX_DECODE_TABLE;
        }
        else {
            this.encodeTable = ENCODE_TABLE;
            this.decodeTable = DECODE_TABLE;
        }
        if (lineLength > 0) {
            if (lineSeparator == null) {
                throw new IllegalArgumentException("lineLength " + lineLength + " > 0, but lineSeparator is null");
            }
            // Must be done after initializing the tables
            if (containsAlphabetOrPad(lineSeparator)) {
                final String sep = StringUtils.newStringUtf8(lineSeparator);
                throw new IllegalArgumentException("lineSeparator must not contain Base32 characters: [" + sep + "]");
            }
            this.encodeSize = BYTES_PER_ENCODED_BLOCK + lineSeparator.length;
            this.lineSeparator = new byte[lineSeparator.length];
            System.arraycopy(lineSeparator, 0, this.lineSeparator, 0, lineSeparator.length);
        }
        else {
            this.encodeSize = BYTES_PER_ENCODED_BLOCK;
            this.lineSeparator = null;
        }
        this.decodeSize = this.encodeSize - 1;

        if (isInAlphabet(pad) || isWhiteSpace(pad)) {
            throw new IllegalArgumentException("pad must not be in alphabet or whitespace");

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Pass a non-null lineSeparator when lineLength > 0
  2. Set lineLength to 0 if unchunked single-line output is wanted
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-common/src/main/java/com/facebook/presto/common/type/encoding/Base32.java:290 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/3da601259b179185. Report an issue: GitHub.