{"record":{"id":"19261d1c7125fd14","repo":"apache/flink","slug":"could-not-load-the-avrotypeinfo-class-you-may-be","errorCode":null,"errorMessage":"Could not load the AvroTypeInfo class. You may be missing the 'flink-avro' dependency.","messagePattern":"Could not load the AvroTypeInfo class\\. You may be missing the 'flink-avro' dependency\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/api/java/typeutils/AvroUtils.java","lineNumber":151,"sourceCode":"        public void addAvroGenericDataArrayRegistration(\n                LinkedHashMap<String, KryoRegistration> kryoRegistrations) {\n            kryoRegistrations.put(\n                    AVRO_GENERIC_DATA_ARRAY,\n                    new KryoRegistration(\n                            Serializers.DummyAvroRegisteredClass.class,\n                            (Class) Serializers.DummyAvroKryoSerializerClass.class));\n        }\n\n        @Override\n        public <T> TypeSerializer<T> createAvroSerializer(Class<T> type) {\n            throw new RuntimeException(\n                    \"Could not load the AvroSerializer class. \"\n                            + \"You may be missing the 'flink-avro' dependency.\");\n        }\n\n        @Override\n        public <T> TypeInformation<T> createAvroTypeInfo(Class<T> type) {\n            throw new RuntimeException(\n                    \"Could not load the AvroTypeInfo class. \"\n                            + \"You may be missing the 'flink-avro' dependency.\");\n        }\n    }\n}\n","sourceCodeStart":133,"sourceCodeEnd":157,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/api/java/typeutils/AvroUtils.java#L133-L157","documentation":"Thrown by DefaultAvroUtils.createAvroTypeInfo() when TypeExtractor needs AvroTypeInfo for an Avro record class but flink-avro is absent. AvroTypeInfo is defined in flink-avro and provides Avro-specific schema-aware type information; the no-Avro fallback cannot fabricate it and fails loudly.","triggerScenarios":"TypeExtractor determines a class is an Avro record and routes to createAvroTypeInfo(); DefaultAvroUtils throws because flink-avro is missing.","commonSituations":"Returning an Avro record from a function whose return type is inferred; registering an Avro POJO for type extraction; a UDF whose output type is Avro.","solutions":["Add flink-avro dependency (provided scope when cluster provides it).","Verify the Avro record class actually needs AvroTypeInfo; if so the jar is mandatory.","Eliminate the Avro type if you cannot add the dependency by mapping to a POJO/tuple."],"exampleFix":"// before\nDataStream<MyAvroRecord> out = in.map(x -> toAvro(x)); // type info needs flink-avro\n\n// after: add dependency so AvroTypeInfo resolves\n<dependency>\n  <groupId>org.apache.flink</groupId><artifactId>flink-avro</artifactId><version>${flink.version}</version><scope>provided</scope>\n</dependency>","handlingStrategy":"validation","validationCode":"if (!AvroUtils.tryGetAvroUtils().isPresent() && isAvroRecordClass(myClass)) {\n    throw new IllegalStateException(\"flink-avro missing; cannot create AvroTypeInfo\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Add flink-avro when your functions return Avro records.","Otherwise map Avro records to POJOs to avoid needing AvroTypeInfo.","Confirm the dependency scope matches your deployment."],"tags":["avro","missing-dependency","type-info","type-system"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}