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

  1. Provide the TypeInformation explicitly via `.returns(...)` to bypass extraction
  2. Implement ResultTypeQueryable on the function to supply type info directly
  3. Check if the function class has any unusual annotations or type signatures that confuse the extractor
  4. 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

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


AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14). Data as JSON: /api/errors/56e86406dd2efc67. Report an issue: GitHub.