apache/seatunnel · error · IllegalArgumentException

Unsupported Int bit width:

Error message

Unsupported Int bit width: 

What it means

IntTypeWriter.writeToVector switches on the Arrow IntType bitWidth (8/16/32/64) to pick the matching Arrow vector; any other bitWidth hits the default branch and throws IllegalArgumentException. It means the integer column's Arrow bit width is not a standard supported one.

Source

Thrown at seatunnel-connectors-v2/connector-lance/src/main/java/org/apache/seatunnel/connectors/seatunnel/lance/sink/writers/IntTypeWriter.java:56

            BufferAllocator allocator) {
        ArrowType.Int intType = (ArrowType.Int) arrowType;
        int bitWidth = intType.getBitWidth();
        Number numValue = (Number) value;
        switch (bitWidth) {
            case 8:
                ((TinyIntVector) vector).setSafe(rowIndex, numValue.byteValue());
                break;
            case 16:
                ((SmallIntVector) vector).setSafe(rowIndex, numValue.shortValue());
                break;
            case 32:
                ((IntVector) vector).setSafe(rowIndex, numValue.intValue());
                break;
            case 64:
                ((BigIntVector) vector).setSafe(rowIndex, numValue.longValue());
                break;
            default:
                throw new IllegalArgumentException("Unsupported Int bit width: " + bitWidth);
        }
    }

    @Override
    public void writeToListWriter(
            UnionListWriter writer, ArrowType arrowType, Object value, BufferAllocator allocator) {
        ArrowType.Int intType = (ArrowType.Int) arrowType;
        int bitWidth = intType.getBitWidth();
        Number numValue = (Number) value;
        switch (bitWidth) {
            case 8:
                writer.writeTinyInt(numValue.byteValue());
                break;
            case 16:
                writer.writeSmallInt(numValue.shortValue());
                break;
            case 32:
                writer.writeInt(numValue.intValue());

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Use standard bit widths (8, 16, 32, 64) when building/converting the schema (IntType(32, true) etc.).
  2. Fix the schema conversion utility that produced the nonstandard Int type.
  3. Upgrade the connector if a new Arrow integer variant needs support.

Example fix

// before
new ArrowType.Int(128, true) // invalid
// after
new ArrowType.Int(64, true)
Defensive patterns

Strategy: validation

Validate before calling

ArrowType t = field.getType(); if (t instanceof ArrowType.Int) { int bw = ((ArrowType.Int) t).getBitWidth(); if (bw != 8 && bw != 16 && bw != 32 && bw != 64) throw new IllegalArgumentException("unsupported int bit width " + bw); }

Try / catch

try { writer.write(row); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith("Unsupported Int bit width")) { /* fix schema to standard widths */ } throw e; }

Prevention

When it happens

Trigger: An ArrowType.Int with bitWidth other than 8, 16, 32, or 64 (or bitWidth 8/16 when their vectors are not registered in this writer version) reaches writeToVector.

Common situations: Hand-constructed Arrow schemas in tests or custom schema-conversion code using a wrong bitWidth; a Lance/Arrow SDK upgrade introducing a new integer variant the connector does not yet map.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/a85e32f660d68514. Report an issue: GitHub.