apache/beam · error · RuntimeException
AutoValue builder class ${builderTypeDescriptor} did not con
Error message
AutoValue builder class ${builderTypeDescriptor} did not contain a setter for ${autoValueFieldName} What it means
AutoValueUtils translates getters on an @AutoValue class into setters on its generated Builder to build schemas. getBuilderCreator throws RuntimeException when, for a given AutoValue field name, the builder class exposes no matching setter method — so a Row value cannot be mapped back into the builder.
Source
Thrown at sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/utils/AutoValueUtils.java:260
ReflectUtils.getMethods(builderTypeDescriptor.getRawType()).stream()
.filter(ReflectUtils::isSetter)
.map(m -> FieldValueTypeInformation.forSetter(builderTypeDescriptor, m))
.forEach(fv -> setterTypes.putIfAbsent(fv.getName(), fv));
List<FieldValueTypeInformation> setterMethods =
Lists.newArrayList(); // The builder methods to call in order.
List<FieldValueTypeInformation> schemaTypes =
fieldValueTypeSupplier.get(typeDescriptor, schema);
for (FieldValueTypeInformation type : schemaTypes) {
String autoValueFieldName =
ReflectUtils.stripGetterPrefix(
Preconditions.checkArgumentNotNull(
type.getMethod(), JavaBeanUtils.GETTER_WITH_NULL_METHOD_ERROR)
.getName());
FieldValueTypeInformation setterType = setterTypes.get(autoValueFieldName);
if (setterType == null) {
throw new RuntimeException(
"AutoValue builder class "
+ builderTypeDescriptor
+ " did not contain "
+ "a setter for "
+ autoValueFieldName);
}
setterMethods.add(setterType);
}
Method buildMethod =
ReflectUtils.getMethods(builderTypeDescriptor.getRawType()).stream()
.filter(m -> m.getName().equals("build"))
.findAny()
.orElseThrow(() -> new RuntimeException("No build method in builder"));
return createBuilderCreator(
builderTypeDescriptor.getRawType(), setterMethods, buildMethod, schema, schemaTypes);
}
View on GitHub (pinned to 12126d8942)
Solutions
- Regenerate AutoValue classes with a matching AutoValue version (clean rebuild)
- Ensure the class is truly annotated with @AutoValue so its generated Builder includes setters for all fields
- Check for stale/shaded artifacts where the builder and value class come from different builds
- Compare the AutoValue class getters with the builder setter names to spot mismatches
Example fix
// before // @AutoValue class has field 'userId' but builder was built from stale generated code without setUserId // after mvn clean compile # regenerate AutoValue builder with setUserId for field userId
Defensive patterns
Strategy: try-catch
Validate before calling
for (String getter : autoValueFieldNames) {
if (!builderSetterNames.contains(getter))
throw new IllegalStateException("Builder missing setter for " + getter);
} Try / catch
try { Row[] rows = AutoValueUtils.getRowsFromAutoValue(...); }
catch (RuntimeException e) { if (e.getMessage().contains("did not contain a setter")) { /* rebuild/regenerate */ } else throw e; } Prevention
- Clean-rebuild so generated builders match the annotated classes
- Keep AutoValue versions consistent across modules
- Avoid mixing hand-written builder classes with AutoValue-generated ones
When it happens
Trigger: getBuilderCreator iterates the AutoValue class getters, looks each field up in the builder's setterTypes map, and finds null because the generated builder lacks a setter with that name.
Common situations: Mismatched/incompatible AutoValue versions where builder method naming differs; hand-written or partial builder-like classes; the builder class is stale relative to the annotated class after adding a field without regenerating.
Related errors
- error when invoking Coder factory method
- cannot register Coder : does not have an accessible method n
- cannot register Coder : method named 'of' with arguments of
- cannot register Coder : method named 'of' with arguments of
- cannot register Coder : method named 'of' with arguments of
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/d3c33d4e0b19af1f.
Report an issue: GitHub.