{"record":{"id":"3dd3530f77ea5def","repo":"apache/flink","slug":"generic-types-have-been-disabled-in-the-executionc","errorCode":null,"errorMessage":"Generic types have been disabled in the ExecutionConfig and type {} is treated as a generic type.","messagePattern":"Generic types have been disabled in the ExecutionConfig and type (.+?) is treated as a generic type\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/api/java/typeutils/GenericTypeInfo.java","lineNumber":86,"sourceCode":"    }\n\n    @Override\n    @PublicEvolving\n    public Class<T> getTypeClass() {\n        return typeClass;\n    }\n\n    @Override\n    @PublicEvolving\n    public boolean isKeyType() {\n        return Comparable.class.isAssignableFrom(typeClass);\n    }\n\n    @Override\n    @PublicEvolving\n    public TypeSerializer<T> createSerializer(SerializerConfig config) {\n        if (config.hasGenericTypesDisabled()) {\n            throw new UnsupportedOperationException(\n                    \"Generic types have been disabled in the ExecutionConfig and type \"\n                            + this.typeClass.getName()\n                            + \" is treated as a generic type.\");\n        }\n\n        return new KryoSerializer<T>(this.typeClass, config);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    @PublicEvolving\n    public TypeComparator<T> createComparator(\n            boolean sortOrderAscending, ExecutionConfig executionConfig) {\n        if (isKeyType()) {\n            @SuppressWarnings(\"rawtypes\")\n            GenericTypeComparator comparator =\n                    new GenericTypeComparator(\n                            sortOrderAscending,","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/api/java/typeutils/GenericTypeInfo.java#L68-L104","documentation":"Thrown by GenericTypeInfo.createSerializer() when ExecutionConfig has disabled generic types (hasGenericTypesDisabled() == true) but the type in question is a generic type (i.e. only Kryo could serialize it). Disabling generic types is an explicit opt-in safety feature that forces users to provide proper POJO/Avro type info; hitting this error means a type fell through to the generic/Kryo fallback that the user forbade.","triggerScenarios":"Calling executionConfig.disableGenericTypes() (or the equivalent) and then having TypeExtractor produce a GenericTypeInfo for some type in the job, which triggers createSerializer().","commonSituations":"A team enables 'no generics' to enforce type safety, then introduces a type Flink cannot treat as a POJO (missing getter/setter, non-public class, nested generics) so it degrades to generic and the serializer creation fails at runtime.","solutions":["Make the offending class a proper POJO (public, no-arg constructor, public getters/setters) so Flink uses PojoTypeInfo instead of GenericTypeInfo.","Register an explicit TypeInformation / TypeSerializer for the class via .registerTypeWithKryoSerializer or a TypeInfoFactory.","If Kryo is acceptable, re-enable generic types: executionConfig.enableGenericTypes().","Switch to a Tuple, Row, or Avro type that Flink understands natively."],"exampleFix":"// before\nenv.getConfig().disableGenericTypes();\nenv.fromElements(new MyType()); // MyType not a valid POJO -> GenericTypeInfo -> throw\n\n// after: make MyType a proper POJO\npublic class MyType {\n  public MyType() {}\n  private int v; public int getV(){return v;} public void setV(int v){this.v=v;}\n}","handlingStrategy":"validation","validationCode":"// Validate type is a POJO before disabling generics\nif (TypeInformation.of(MyType.class) instanceof GenericTypeInfo) {\n    throw new IllegalStateException(\"MyType is generic; make it a POJO before disableGenericTypes()\");\n}","typeGuard":"static boolean isPojo(Class<?> c) {\n    return TypeInformation.of(c) instanceof org.apache.flink.api.java.typeutils.PojoTypeInfo;\n}","tryCatchPattern":null,"preventionTips":["Ensure all domain types are valid POJOs before calling disableGenericTypes().","Add TypeInfoFactory annotations to enforce type safety.","Run a local job to surface degradation to generic before production."],"tags":["type-info","generic-type","kryo","execution-config"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}