{"record":{"id":"40586a52e0c620de","repo":"apache/flink","slug":"unknown-error-type-is-null","errorCode":null,"errorMessage":"Unknown Error. Type is null.","messagePattern":"Unknown Error\\. Type is null\\.","errorType":"exception","errorClass":"InvalidTypesException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java","lineNumber":1490,"sourceCode":"        Type inType;\n        try {\n            inType = getParameterType(baseClass, typeHierarchy, clazz, inputParamPos);\n        } catch (InvalidTypesException e) {\n            return; // skip input validation e.g. for raw types\n        }\n\n        try {\n            validateInfo(typeHierarchy, inType, inTypeInfo);\n        } catch (InvalidTypesException e) {\n            throw new InvalidTypesException(\"Input mismatch: \" + e.getMessage(), e);\n        }\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private static void validateInfo(\n            List<Type> typeHierarchy, Type type, TypeInformation<?> typeInfo) {\n        if (type == null) {\n            throw new InvalidTypesException(\"Unknown Error. Type is null.\");\n        }\n\n        if (typeInfo == null) {\n            throw new InvalidTypesException(\"Unknown Error. TypeInformation is null.\");\n        }\n\n        if (!(type instanceof TypeVariable<?>)) {\n            // check for Java Basic Types\n            if (typeInfo instanceof BasicTypeInfo) {\n\n                TypeInformation<?> actual;\n                // check if basic type at all\n                if (!(type instanceof Class<?>)\n                        || (actual = BasicTypeInfo.getInfoFor((Class<?>) type)) == null) {\n                    throw new InvalidTypesException(\"Basic type expected.\");\n                }\n                // check if correct basic type\n                if (!typeInfo.equals(actual)) {","sourceCodeStart":1472,"sourceCodeEnd":1508,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java#L1472-L1508","documentation":"Thrown at the start of `validateInfo` when the `type` argument (extracted from the function's signature via reflection) is null. This indicates an internal extraction failure where getParameterType returned null instead of throwing earlier, which should not happen under normal operation. It is a defensive guard against an unexpected internal state.","triggerScenarios":"During input type validation, the Type object extracted by `getParameterType` from the function class hierarchy is null. This is typically an internal bug or an edge case in the extraction logic where a type could not be determined but null was returned instead of an exception being thrown.","commonSituations":"Rare internal extraction failure during input validation. Usually preceded by a partial type extraction that silently returned null. May occur with unusual class hierarchies or synthetic classes that confuse the reflection-based extractor.","solutions":["Implement ResultTypeQueryable to bypass reflection-based type extraction entirely","Simplify the function's class hierarchy to avoid confusing the extractor","Provide TypeInformation explicitly via `.returns(...)` or `.type(...)`","Report as a Flink bug if it occurs with a straightforward function implementation"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    resultStream = inputStream.map(myFunction);\n} catch (InvalidTypesException e) {\n    if (e.getMessage().contains(\"Type is null\")) {\n        // Internal extraction failure — bypass with explicit type\n        resultStream = inputStream.map(myFunction)\n            .returns(TypeInformation.of(MyOutputType.class));\n    } else {\n        throw e;\n    }\n}","preventionTips":["Implement ResultTypeQueryable to bypass reflection-based extraction","Keep function class hierarchies simple and standard","Report this as a bug if it occurs with standard Flink functions","Provide explicit TypeInformation via .returns() as a workaround"],"tags":["type-extraction","internal-error","null-type","validation"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}