{"record":{"id":"39908c006e396a1a","repo":"apache/flink","slug":"type-at-position-is-not-a-basic-or-value-type","errorCode":null,"errorMessage":"Type at position {} is not a basic or value type.","messagePattern":"Type at position (.+?) is not a basic or value type\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/api/java/typeutils/TupleTypeInfo.java","lineNumber":254,"sourceCode":"    public static <X extends Tuple> TupleTypeInfo<X> getBasicAndBasicValueTupleTypeInfo(\n            Class<?>... basicTypes) {\n        if (basicTypes == null || basicTypes.length == 0) {\n            throw new IllegalArgumentException();\n        }\n\n        TypeInformation<?>[] infos = new TypeInformation<?>[basicTypes.length];\n        for (int i = 0; i < infos.length; i++) {\n            Class<?> type = basicTypes[i];\n            if (type == null) {\n                throw new IllegalArgumentException(\"Type at position \" + i + \" is null.\");\n            }\n\n            TypeInformation<?> info = BasicTypeInfo.getInfoFor(type);\n            if (info == null) {\n                try {\n                    info = ValueTypeInfo.getValueTypeInfo((Class<Value>) type);\n                    if (!((ValueTypeInfo<?>) info).isBasicValueType()) {\n                        throw new IllegalArgumentException(\n                                \"Type at position \" + i + \" is not a basic or value type.\");\n                    }\n                } catch (ClassCastException | InvalidTypesException e) {\n                    throw new IllegalArgumentException(\n                            \"Type at position \" + i + \" is not a basic or value type.\", e);\n                }\n            }\n            infos[i] = info;\n        }\n\n        return (TupleTypeInfo<X>) new TupleTypeInfo<>(infos);\n    }\n\n    private static int[] listToPrimitives(ArrayList<Integer> ints) {\n        int[] result = new int[ints.size()];\n        for (int i = 0; i < result.length; i++) {\n            result[i] = ints.get(i);\n        }","sourceCodeStart":236,"sourceCodeEnd":272,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TupleTypeInfo.java#L236-L272","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nTupleTypeInfo.getBasicAndBasicValueTupleTypeInfo(MyCustomValue.class);\n// after\nTupleTypeInfo.getBasicAndBasicValueTupleTypeInfo(IntValue.class);","handlingStrategy":"type-guard","validationCode":"for (Class<?> c : basicTypes) {\n    if (BasicTypeInfo.getInfoFor(c) == null\n            && !(Value.class.isAssignableFrom(c)\n                && ((ValueTypeInfo<?>) ValueTypeInfo.getValueTypeInfo((Class<Value>) c))\n                    .isBasicValueType())) {\n        throw new IllegalArgumentException(\n            \"Not a basic or basic-value type: \" + c);\n    }\n}","typeGuard":"boolean isBasicOrBasicValue(Class<?> c) {\n    if (BasicTypeInfo.getInfoFor(c) != null) return true;\n    if (!Value.class.isAssignableFrom(c)) return false;\n    return ((ValueTypeInfo<?>) ValueTypeInfo.getValueTypeInfo((Class<Value>) c))\n        .isBasicValueType();\n}","tryCatchPattern":null,"preventionTips":["Only use basic types or their Value wrappers (IntValue, StringValue, etc.).","For custom Value types, use the TupleTypeInfo constructor directly."],"tags":["tuple","value-type","basic-type","type-system","factory-method","flink-core"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}