apache/beam · error · RuntimeException
Unable to generate a getter for class
Error message
Unable to generate a getter for class ${clazz} with schema ${schema} What it means
After generating the accessor bytecode, AvroByteBuddyUtils instantiates the generated class; any InstantiationException/IllegalAccessException/NoSuchMethodException/InvocationTargetException during that instantiation is rethrown as RuntimeException. It indicates the generated getter/creator class could not be constructed for the given class+schema pair.
Solutions
- Check the suppressed/underlying exception on the runtime error for the real reflective failure cause
- Regenerate the Avro class from the current schema so bytecode matches
- Disable ByteBuddy optimization (AvroUtils/AvroByteBuddyUtils toggle) to use reflection fallback
- Verify JDK/Beam version compatibility for ByteBuddy
Example fix
null
Defensive patterns
Strategy: try-catch
Try / catch
try { return AvroByteBuddyUtils.getTypeCreator(clazz, schema); } catch (RuntimeException e) { return reflectivelyCreate(clazz, schema); } Prevention
- Check the exception's suppressed causes to find the real reflective failure
- Confirm the class has accessible constructors in the executing classloader
- Test ByteBuddy generation on the target JDK before deploying
- Use reflection fallback when running under restricted module systems
When it happens
Trigger: getCreator/createCreator hitting reflective instantiation failure — typically because the target class cannot be instantiated in the current classloader context (abstract class, missing no-arg path, restricted module access, or Java module/JDK incompatibility with ByteBuddy generation).
Common situations: Running on newer JDKs where ByteBuddy-generated classes fail reflective construction, classes with private/absent constructors, or mismatched schema causing bad generated bytecode parameters.
Related errors
- Couldn't set the specified Avro data model
- ${e.getMessage()}
- Failed to locate ProcessContinuation.stop()
- Failed to locate required method
- No code generation strategy available
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/eddd644170f0427b.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/java/extensions/avro/src/main/java/org/apache/beam/sdk/extensions/avro/schemas/utils/AvroByteBuddyUtils.java:107
.with(new InjectPackageStrategy(clazz))
.subclass(SchemaUserTypeCreator.class)
.method(ElementMatchers.named("create"))
.intercept(construct);
return builder
.visit(new AsmVisitorWrapper.ForDeclaredMethods().writerFlags(ClassWriter.COMPUTE_FRAMES))
.make()
.load(
ReflectHelpers.findClassLoader(clazz.getClassLoader()),
getClassLoadingStrategy(clazz))
.getLoaded()
.getDeclaredConstructor()
.newInstance();
} catch (InstantiationException
| IllegalAccessException
| NoSuchMethodException
| InvocationTargetException e) {
throw new RuntimeException(
"Unable to generate a getter for class " + clazz + " with schema " + schema);
}
}
private static StackManipulation readAndConvertParameter(
Class<?> constructorParameterType, int index) {
TypeConversionsFactory typeConversionsFactory = new AvroUtils.AvroTypeConversionFactory();
// The types in the AVRO-generated constructor might be the types returned by Beam's Row class,
// so we have to convert the types used by Beam's Row class.
// We know that AVRO generates constructor parameters in the same order as fields
// in the schema, so we can just add the parameters sequentially.
TypeConversion<Type> convertType = typeConversionsFactory.createTypeConversion(true);
// Map the AVRO-generated type to the one Beam will use.
ForLoadedType convertedType =
new ForLoadedType((Class) convertType.convert(TypeDescriptor.of(constructorParameterType)));
View on GitHub (pinned to 12126d8942)