apache/flink · error · IllegalArgumentException

Type at position {} is null.

Error message

Type at position {} is null.

What it means

Thrown by TupleTypeInfo.getBasicTupleTypeInfo(Class<?>...) when an element of the varargs Class array is null. This is a plain IllegalArgumentException. The method constructs a TupleTypeInfo of basic types from the provided Class objects, so null is invalid.

Source

Thrown at flink-core/src/main/java/org/apache/flink/api/java/typeutils/TupleTypeInfo.java:218

    @Override
    public String toString() {
        return "Java " + super.toString();
    }

    // --------------------------------------------------------------------------------------------

    @PublicEvolving
    public static <X extends Tuple> TupleTypeInfo<X> getBasicTupleTypeInfo(Class<?>... basicTypes) {
        if (basicTypes == null || basicTypes.length == 0) {
            throw new IllegalArgumentException();
        }

        TypeInformation<?>[] infos = new TypeInformation<?>[basicTypes.length];
        for (int i = 0; i < infos.length; i++) {
            Class<?> type = basicTypes[i];
            if (type == null) {
                throw new IllegalArgumentException("Type at position " + i + " is null.");
            }

            TypeInformation<?> info = BasicTypeInfo.getInfoFor(type);
            if (info == null) {
                throw new IllegalArgumentException(
                        "Type at position " + i + " is not a basic type.");
            }
            infos[i] = info;
        }

        @SuppressWarnings("unchecked")
        TupleTypeInfo<X> tupleInfo = (TupleTypeInfo<X>) new TupleTypeInfo<Tuple>(infos);
        return tupleInfo;
    }

    @SuppressWarnings("unchecked")
    @PublicEvolving
    public static <X extends Tuple> TupleTypeInfo<X> getBasicAndBasicValueTupleTypeInfo(

View on GitHub (pinned to 2f3c205e92)

Solutions

  1. Remove or replace the null element in the Class varargs.
  2. If building from a dynamic list, filter out nulls before calling.

Example fix

// before
TupleTypeInfo.getBasicTupleTypeInfo(String.class, null, Integer.class);
// after
TupleTypeInfo.getBasicTupleTypeInfo(String.class, Integer.class);
Defensive patterns

Strategy: validation

Validate before calling

for (Class<?> c : basicTypes) {
    if (c == null) {
        throw new IllegalArgumentException(
            "Null type in array at position " + i);
    }
}
TupleTypeInfo.getBasicTupleTypeInfo(basicTypes);

Prevention

When it happens

Trigger: Calling TupleTypeInfo.getBasicTupleTypeInfo(String.class, null, Integer.class) — the second argument is null. The loop at line 216 checks each element and throws at position i.

Common situations: Programmatic tuple type construction where one Class reference came from an uninitialized variable, a failed Class.forName, or a list containing nulls. Rarely seen in declarative DataStream code.

Related errors


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