apache/flink · error · IllegalArgumentException
Type at position {} is not a basic or value type.
Error message
Type at position {} is not a basic or value type. What it means
Thrown by TupleTypeInfo.getBasicAndBasicValueTupleTypeInfo(Class<?>...) when the Class is not a basic type AND is either a Value type that is not a basic Value type, or fails the isBasicValueType() check. This method accepts basic types or Flink Value types that wrap basic types (e.g. IntValue, StringValue, LongValue). This is a plain IllegalArgumentException.
Source
Thrown at flink-core/src/main/java/org/apache/flink/api/java/typeutils/TupleTypeInfo.java:254
public static <X extends Tuple> TupleTypeInfo<X> getBasicAndBasicValueTupleTypeInfo(
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) {
try {
info = ValueTypeInfo.getValueTypeInfo((Class<Value>) type);
if (!((ValueTypeInfo<?>) info).isBasicValueType()) {
throw new IllegalArgumentException(
"Type at position " + i + " is not a basic or value type.");
}
} catch (ClassCastException | InvalidTypesException e) {
throw new IllegalArgumentException(
"Type at position " + i + " is not a basic or value type.", e);
}
}
infos[i] = info;
}
return (TupleTypeInfo<X>) new TupleTypeInfo<>(infos);
}
private static int[] listToPrimitives(ArrayList<Integer> ints) {
int[] result = new int[ints.size()];
for (int i = 0; i < result.length; i++) {
result[i] = ints.get(i);
}View on GitHub (pinned to 2f3c205e92)
Solutions
- Use only basic types or their Value wrappers (IntValue, LongValue, DoubleValue, StringValue, etc.).
- For arbitrary Value types, use 'new TupleTypeInfo<>(TypeInformation.of(MyValue.class))'.
- For arbitrary classes, use the TupleTypeInfo constructor with explicit TypeInformation.
Example fix
// before TupleTypeInfo.getBasicAndBasicValueTupleTypeInfo(MyCustomValue.class); // after TupleTypeInfo.getBasicAndBasicValueTupleTypeInfo(IntValue.class);
Defensive patterns
Strategy: type-guard
Validate before calling
for (Class<?> c : basicTypes) {
if (BasicTypeInfo.getInfoFor(c) == null
&& !(Value.class.isAssignableFrom(c)
&& ((ValueTypeInfo<?>) ValueTypeInfo.getValueTypeInfo((Class<Value>) c))
.isBasicValueType())) {
throw new IllegalArgumentException(
"Not a basic or basic-value type: " + c);
}
} Type guard
boolean isBasicOrBasicValue(Class<?> c) {
if (BasicTypeInfo.getInfoFor(c) != null) return true;
if (!Value.class.isAssignableFrom(c)) return false;
return ((ValueTypeInfo<?>) ValueTypeInfo.getValueTypeInfo((Class<Value>) c))
.isBasicValueType();
} Prevention
- Only use basic types or their Value wrappers (IntValue, StringValue, etc.).
- For custom Value types, use the TupleTypeInfo constructor directly.
When it happens
Trigger: Calling getBasicAndBasicValueTupleTypeInfo(MyCustomValue.class) where MyCustomValue extends Value but is not a basic value type, or passing a Class that is a Value but not one of the basic value wrappers.
Common situations: Developer passes a custom Value implementation or a non-basic Value type expecting it to work. The method is specifically for tuples of basic types and their Value-wrapper equivalents.
Related errors
- Type at position {} is not a basic type.
- Type at position {} is null.
- Specifying keys via field positions is only valid for tuple
- Invalid tuple field reference "{}".
- Tuple field expression "{}" out of bounds of {}.
AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14).
Data as JSON: /api/errors/39908c006e396a1a.
Report an issue: GitHub.