{"record":{"id":"8cd30aa331c8409a","repo":"apache/beam","slug":"unable-to-automatically-infer-a-coder-for-the-kafka","errorCode":null,"errorMessage":"Unable to automatically infer a Coder for the Kafka Deserializer %s: no coder registered for type %s","messagePattern":"Unable to automatically infer a Coder for the Kafka Deserializer (.+?): no coder registered for type (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/LocalDeserializerProvider.java","lineNumber":93,"sourceCode":"    for (Type type : deserializer.getGenericInterfaces()) {\n      if (!(type instanceof ParameterizedType)) {\n        continue;\n      }\n\n      // This does not recurse: we will not infer from a class that extends\n      // a class that extends Deserializer<T>.\n      ParameterizedType parameterizedType = (ParameterizedType) type;\n\n      if (parameterizedType.getRawType() == Deserializer.class) {\n        Type parameter = parameterizedType.getActualTypeArguments()[0];\n\n        @SuppressWarnings(\"unchecked\")\n        Class<T> clazz = (Class<T>) parameter;\n\n        try {\n          return NullableCoder.of(coderRegistry.getCoder(clazz));\n        } catch (CannotProvideCoderException e) {\n          throw new RuntimeException(\n              String.format(\n                  \"Unable to automatically infer a Coder for \"\n                      + \"the Kafka Deserializer %s: no coder registered for type %s\",\n                  deserializer, clazz));\n        }\n      }\n    }\n    throw new RuntimeException(\n        String.format(\"Could not extract the Kafka Deserializer type from %s\", deserializer));\n  }\n}\n","sourceCodeStart":75,"sourceCodeEnd":105,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/LocalDeserializerProvider.java#L75-L105","documentation":"LocalDeserializerProvider.getNullableCoder infers the Beam Coder by reading the Deserializer<T> generic type parameter and asking the CoderRegistry for a coder of that class. When no coder is registered for the deserializer's target type, this RuntimeException fires — Beam cannot serialize the deserialized records without an explicit coder.","triggerScenarios":"Thrown at sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/LocalDeserializerProvider.java:93 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Register a Coder for the deserializer's output type in the CoderRegistry.","Set the coder explicitly on the transform instead of relying on inference.","Use a deserializer whose generic type has a built-in coder (primitives, String, Avro, etc.)."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}