apache/flink · error · InvalidTypesException
Unknown Error. TypeInformation is null.
Error message
Unknown Error. TypeInformation is null.
What it means
Thrown at the start of `validateInfo` when the `typeInfo` argument passed to validation is null. Unlike error 608 (null extracted Type), this means the TypeInformation object itself — the one the framework is trying to validate against — was never produced or was passed as null. This is a defensive guard indicating that type information extraction failed silently upstream.
Source
Thrown at flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java:1494
return; // skip input validation e.g. for raw types
}
try {
validateInfo(typeHierarchy, inType, inTypeInfo);
} catch (InvalidTypesException e) {
throw new InvalidTypesException("Input mismatch: " + e.getMessage(), e);
}
}
@SuppressWarnings("unchecked")
private static void validateInfo(
List<Type> typeHierarchy, Type type, TypeInformation<?> typeInfo) {
if (type == null) {
throw new InvalidTypesException("Unknown Error. Type is null.");
}
if (typeInfo == null) {
throw new InvalidTypesException("Unknown Error. TypeInformation is null.");
}
if (!(type instanceof TypeVariable<?>)) {
// check for Java Basic Types
if (typeInfo instanceof BasicTypeInfo) {
TypeInformation<?> actual;
// check if basic type at all
if (!(type instanceof Class<?>)
|| (actual = BasicTypeInfo.getInfoFor((Class<?>) type)) == null) {
throw new InvalidTypesException("Basic type expected.");
}
// check if correct basic type
if (!typeInfo.equals(actual)) {
throw new InvalidTypesException(
"Basic type '" + typeInfo + "' expected but was '" + actual + "'.");
}
View on GitHub (pinned to 2f3c205e92)
Solutions
- Provide the TypeInformation explicitly via `.returns(...)` to bypass extraction
- Implement ResultTypeQueryable on the function to supply type info directly
- Check if the function class has any unusual annotations or type signatures that confuse the extractor
- Report as a bug if it occurs with standard Flink function implementations
Defensive patterns
Strategy: fallback
Try / catch
try {
resultStream = inputStream.map(myFunction);
} catch (InvalidTypesException e) {
if (e.getMessage().contains("TypeInformation is null")) {
// Extraction returned null — provide type explicitly
resultStream = inputStream.map(myFunction)
.returns(TypeInformation.of(MyOutputType.class));
} else {
throw e;
}
} Prevention
- Implement ResultTypeQueryable on functions that have complex type hierarchies
- Provide TypeInformation explicitly via .returns() when extraction is unreliable
- Verify TypeExtractor.createTypeInfo() returns non-null before using the function
- Report this as a bug if it occurs with straightforward function implementations
When it happens
Trigger: The TypeInformation for the function's input or output could not be extracted and resulted in null being passed to validateInfo. This can happen when the framework's extraction pipeline silently returns null instead of throwing, and that null propagates to the validation step.
Common situations: An upstream extraction step failed to produce TypeInformation. A custom function or connector that incorrectly reports its type as null. Internal state corruption during extraction. Typically indicates a deeper issue in the type extraction pipeline.
Related errors
- Unknown Error. Type is null.
- The given class is no subclass of {Writable.class.getName()}
- Internal error occurred.
- Collection must not be empty
- {e.getMessage()}
AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14).
Data as JSON: /api/errors/56e86406dd2efc67.
Report an issue: GitHub.