apache/flink · error · UnsupportedOperationException

Unsupported byte value '{}' for row kind.

Error message

Unsupported byte value '{}' for row kind.

What it means

RowKind is an enum of the four change types in Flink's changelog semantics (INSERT=0, UPDATE_BEFORE=1, UPDATE_AFTER=2, DELETE=3). fromByteValue(byte) maps a serialized byte back to the enum; any value outside 0..3 has no representation and throws UnsupportedOperationException.

Source

Thrown at flink-core/src/main/java/org/apache/flink/types/RowKind.java:117

    /**
     * Creates a {@link RowKind} from the given byte value. Each {@link RowKind} has a byte value
     * representation.
     *
     * @see #toByteValue() for mapping of byte value and {@link RowKind}.
     */
    public static RowKind fromByteValue(byte value) {
        switch (value) {
            case 0:
                return INSERT;
            case 1:
                return UPDATE_BEFORE;
            case 2:
                return UPDATE_AFTER;
            case 3:
                return DELETE;
            default:
                throw new UnsupportedOperationException(
                        "Unsupported byte value '" + value + "' for row kind.");
        }
    }
}

View on GitHub (pinned to 2f3c205e92)

Solutions

  1. Verify the byte stream alignment: the kind byte must be read at the exact offset the writer used
  2. Pre-validate: if (value < 0 || value > 3) reject the record before deserialization
  3. If you control the wire format, map custom kind values to the four canonical kinds before encoding

Example fix

// before
RowKind kind = RowKind.fromByteValue(buffer.readByte()); // 0x07 from corrupt stream

// after
byte raw = buffer.readByte();
if (raw < 0 || raw > 3) {
    throw new IOException("Corrupt row kind byte: " + raw);
}
RowKind kind = RowKind.fromByteValue(raw);
Defensive patterns

Strategy: validation

Validate before calling

byte raw = source.readByte();
if (raw < 0 || raw > 3) {
    throw new IOException("Invalid RowKind byte " + raw + " — stream likely corrupt or misaligned");
}
RowKind kind = RowKind.fromByteValue(raw);

Type guard

static boolean isValidRowKindByte(byte b) {
    return b >= 0 && b <= 3;
}

Try / catch

catch (UnsupportedOperationException e) { throw new IOException("Corrupt row kind byte", e); }

Prevention

When it happens

Trigger: Calling RowKind.fromByteValue(b) with b not in {0,1,2,3}; typically during deserialization of a Row's kind byte from a byte buffer, e.g. RowSerializer reading a row kind written by a different or corrupt serializer.

Common situations: Reading changelog-encoded rows produced by a newer/other system that uses extra kind values; corrupted byte buffers (offset drift reading a non-kind byte as the kind); custom serializers that reused the byte for flags.

Related errors


AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14). Data as JSON: /api/errors/d5ce9257f519ab9c. Report an issue: GitHub.