{"record":{"id":"ba60a40227de3e5f","repo":"apache/flink","slug":"could-not-extract-type-information","errorCode":null,"errorMessage":"Could not extract type information.","messagePattern":"Could not extract type information\\.","errorType":"exception","errorClass":"InvalidTypesException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java","lineNumber":785,"sourceCode":"            } else {\n                throw e;\n            }\n        }\n    }\n\n    // --------------------------------------------------------------------------------------------\n    //  Create type information\n    // --------------------------------------------------------------------------------------------\n\n    @SuppressWarnings(\"unchecked\")\n    public static <T> TypeInformation<T> createTypeInfo(Class<T> type) {\n        return (TypeInformation<T>) createTypeInfo((Type) type);\n    }\n\n    public static TypeInformation<?> createTypeInfo(Type t) {\n        TypeInformation<?> ti = new TypeExtractor().privateCreateTypeInfo(t);\n        if (ti == null) {\n            throw new InvalidTypesException(\"Could not extract type information.\");\n        }\n        return ti;\n    }\n\n    /**\n     * Creates a {@link TypeInformation} from the given parameters.\n     *\n     * <p>If the given {@code instance} implements {@link ResultTypeQueryable}, its information is\n     * used to determine the type information. Otherwise, the type information is derived based on\n     * the given class information.\n     *\n     * @param instance instance to determine type information for\n     * @param baseClass base class of {@code instance}\n     * @param clazz class of {@code instance}\n     * @param returnParamPos index of the return type in the type arguments of {@code clazz}\n     * @param <OUT> output type\n     * @return type information\n     */","sourceCodeStart":767,"sourceCodeEnd":803,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java#L767-L803","documentation":"Thrown by TypeExtractor.createTypeInfo(Type) when privateCreateTypeInfo returns null, meaning the type extraction logic could not determine any TypeInformation for the given Type. This is a terminal failure: after traversing factories, tuple handling, POJO analysis, enum handling, and all other type categories, nothing matched.","triggerScenarios":"Calling TypeExtractor.createTypeInfo(SomeUnknownType.class) where the type doesn't fit any known category. The type is an interface with no concrete implementation hints. The type is void.class or Void.class. The type is a synthetic or proxy class that Flink cannot analyze.","commonSituations":"Trying to use an interface or abstract class as a data type without providing TypeInformation. Using Java types that Flink doesn't support natively (e.g. raw Object, or a type that is neither a POJO, Tuple, primitive, nor Avro). Missing TypeInfoFactory for a custom type.","solutions":["Register a TypeInfoFactory for the custom type using TypeExtractor.registerFactory().","Ensure the type is a concrete class with accessible fields (POJO) or use a Tuple.","Provide TypeInformation explicitly via TypeInformation.of(new TypeHint<...>(){}).","If the type is an interface, use a concrete implementation class instead.","Implement ResultTypeQueryable if the type is used as a function output."],"exampleFix":"// before\nTypeInformation<?> ti = TypeExtractor.createTypeInfo(MyInterface.class);\n// after\nTypeExtractor.registerFactory(MyType.class, MyTypeInfoFactory.class);\nTypeInformation<?> ti = TypeExtractor.createTypeInfo(MyType.class);","handlingStrategy":"validation","validationCode":"TypeInformation<?> ti = new TypeExtractor().privateCreateTypeInfo(t);\nif (ti == null) {\n    throw new IllegalArgumentException(\n        \"Flink cannot extract TypeInformation for \" + t\n        + \"; register a TypeInfoFactory or provide it explicitly\");\n}","typeGuard":"static boolean isExtractableType(Class<?> clazz) {\n    return clazz.isPrimitive() || clazz.isEnum()\n        || Tuple.class.isAssignableFrom(clazz)\n        || clazz.isAssignableFrom(String.class)\n        || hasNoArgConstructor(clazz);\n}","tryCatchPattern":"try {\n    TypeInformation<?> ti = TypeExtractor.createTypeInfo(type);\n} catch (InvalidTypesException e) {\n    // register a factory or provide explicit type info\n    TypeInformation<?> ti = TypeInformation.of(new TypeHint<MyType>(){});\n}","preventionTips":["Register a TypeInfoFactory for custom types before using them in Flink programs.","Ensure custom types are concrete classes with accessible fields (POJOs).","Use TypeInformation.of(new TypeHint<...>(){}) for explicit specification.","Implement ResultTypeQueryable for function output types."],"tags":["type-extraction","create-typeinfo","unsupported-type","typeinfo-factory"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}