{"record":{"id":"edd8b804e6257023","repo":"apache/flink","slug":"type-information-could-not-be-created","errorCode":null,"errorMessage":"Type Information could not be created.","messagePattern":"Type Information could not be created\\.","errorType":"exception","errorClass":"InvalidTypesException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java","lineNumber":1019,"sourceCode":"                Class<?> componentClass = componentInfo.getTypeClass();\n                Class<OUT> classArray =\n                        (Class<OUT>)\n                                (java.lang.reflect.Array.newInstance(componentClass, 0).getClass());\n\n                return ObjectArrayTypeInfo.getInfoFor(classArray, componentInfo);\n            }\n        }\n        // objects with generics are treated as Class first\n        else if (t instanceof ParameterizedType) {\n            return privateGetForClass(\n                    typeToClass(t), typeHierarchy, (ParameterizedType) t, in1Type, in2Type);\n        }\n        // no tuple, no TypeVariable, no generic type\n        else if (t instanceof Class) {\n            return privateGetForClass((Class<OUT>) t, typeHierarchy);\n        }\n\n        throw new InvalidTypesException(\"Type Information could not be created.\");\n    }\n\n    private <IN1, IN2> TypeInformation<?> createTypeInfoFromInputs(\n            TypeVariable<?> returnTypeVar,\n            List<Type> returnTypeHierarchy,\n            TypeInformation<IN1> in1TypeInfo,\n            TypeInformation<IN2> in2TypeInfo) {\n\n        Type matReturnTypeVar = materializeTypeVariable(returnTypeHierarchy, returnTypeVar);\n\n        // variable could be resolved\n        if (!(matReturnTypeVar instanceof TypeVariable)) {\n            return createTypeInfoWithTypeHierarchy(\n                    returnTypeHierarchy, matReturnTypeVar, in1TypeInfo, in2TypeInfo);\n        } else {\n            returnTypeVar = (TypeVariable<?>) matReturnTypeVar;\n        }\n","sourceCodeStart":1001,"sourceCodeEnd":1037,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java#L1001-L1037","documentation":"The catch-all failure thrown at the end of `createTypeInfoWithTypeHierarchy` when the given `java.lang.reflect.Type` is none of: a Tuple subclass, a TypeVariable, a GenericArrayType, a ParameterizedType, or a plain Class. This is the 'I don't know what this type is' fallback — it means the Type object fell through every supported branch.","triggerScenarios":"The Type passed to the extractor is an exotic or unsupported java.lang.reflect.Type implementation (e.g. a WildcardType, a synthetic proxy type, or a custom Type implementation). Can also occur with types that represent none of the recognized categories in Java's reflection model.","commonSituations":"Using a function whose type involves wildcard captures (`? extends Number`). Passing a dynamically proxied or bytecode-generated class as a function. Extremely unusual generics involving intersection types or synthetic bridge methods.","solutions":["Implement ResultTypeQueryable on the function and provide the TypeInformation explicitly","Supply TypeInformation via `.returns(...)` on the DataStream operator","Refactor the function to use concrete, supported types instead of exotic generics","Use TypeInformation.of(...) or TypeHint to specify the type manually"],"exampleFix":"// before — exotic or unresolved type\ndataStream.map(new MyWildcardFunction<? extends Number>())\n\n// after — specify type explicitly\ndataStream.map(new MyConcreteFunction())\n          .returns(TypeInformation.of(MyEvent.class));","handlingStrategy":"fallback","validationCode":"// Test type extraction before deploying\ntry {\n    TypeInformation<?> info = TypeExtractor.createTypeInfo(MyFunction.class);\n} catch (InvalidTypesException e) {\n    System.err.println(\"Type extraction failed: \" + e.getMessage()\n        + \" — provide TypeInformation explicitly\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    resultStream = inputStream.map(myFunction);\n} catch (InvalidTypesException e) {\n    // Fall back to explicit type specification\n    resultStream = inputStream.map(myFunction)\n        .returns(TypeInformation.of(MyOutputType.class));\n}","preventionTips":["Use concrete, standard Java types in function signatures","Avoid wildcard types (? extends, ? super) in function generics","Implement ResultTypeQueryable for functions with complex type hierarchies","Validate type extraction in unit tests with TypeExtractor.createTypeInfo()"],"tags":["type-extraction","unsupported-type","reflection","catch-all"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}