apache/beam · error · RuntimeException
Unable to automatically infer a Coder for the Kafka…
Error message
Unable to automatically infer a Coder for the Kafka Deserializer %s: no coder registered for type %s
What it means
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.
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.).
Defensive patterns
Strategy: fallback
When it happens
Trigger: 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.
Common situations: See trigger scenarios.
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/8cd30aa331c8409a.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/LocalDeserializerProvider.java:93
for (Type type : deserializer.getGenericInterfaces()) {
if (!(type instanceof ParameterizedType)) {
continue;
}
// This does not recurse: we will not infer from a class that extends
// a class that extends Deserializer<T>.
ParameterizedType parameterizedType = (ParameterizedType) type;
if (parameterizedType.getRawType() == Deserializer.class) {
Type parameter = parameterizedType.getActualTypeArguments()[0];
@SuppressWarnings("unchecked")
Class<T> clazz = (Class<T>) parameter;
try {
return NullableCoder.of(coderRegistry.getCoder(clazz));
} catch (CannotProvideCoderException e) {
throw new RuntimeException(
String.format(
"Unable to automatically infer a Coder for "
+ "the Kafka Deserializer %s: no coder registered for type %s",
deserializer, clazz));
}
}
}
throw new RuntimeException(
String.format("Could not extract the Kafka Deserializer type from %s", deserializer));
}
}
View on GitHub (pinned to 12126d8942)