apache/beam · error · IllegalArgumentException
Found setters marked with @
Error message
Found setters marked with @%s:
What it means
The aggregated variant of the annotated-setter error: when several setters are wrongly marked with a getter-only annotation, Beam throws one message 'Found setters marked with @%s:' followed by a line per offending setter, then fails options registration.
Solutions
- Strip the named annotation from every setter listed in the message.
- Verify the annotation exists on the corresponding getters.
- Add a lint/checkstyle rule or unit test that calls PipelineOptionsFactory.as() on all option interfaces in CI to catch this early.
Example fix
// before
@Default.Integer(1) int getFoo();
@Default.Integer(1) void setFoo(int v);
@Default.String("s") String getBar();
@Default.String("s") void setBar(String v);
// after
@Default.Integer(1) int getFoo();
void setFoo(int v);
@Default.String("s") String getBar();
void setBar(String v); Defensive patterns
Strategy: validation
Validate before calling
java.util.List<java.lang.reflect.Method> bad = new java.util.ArrayList<>();
for (java.lang.reflect.Method m : MyOptions.class.getMethods()) {
if (m.getName().startsWith("set") && m.getAnnotations().length > 0) bad.add(m);
}
if (!bad.isEmpty()) System.err.println("Setters with getter-only annotations: " + bad); Try / catch
try {
PipelineOptionsFactory.fromArgs(args).as(MyOptions.class);
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("Found setters marked with @")) { /* strip annotations from every listed setter */ }
throw e;
} Prevention
- Fix every setter listed in the aggregated message before re-running
- Add an ArchUnit/checkstyle test banning annotations on set* methods
- Run options validation in CI for all option interfaces
When it happens
Trigger: PipelineOptionsFactory registration when throwForSettersWithTheAnnotation receives setters.size() > 1; the builder appends '%n - Setter for property [...] should not be marked with @%s on [...]' for each before throwing.
Common situations: Generating accessors with a tool/template that copies annotations to setters; large options interfaces where many setters were annotated during a bulk edit.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Expected setter for property
- All inherited interfaces of
- Class ' ' does not implement PipelineRunner. Supported…
- Class missing a property named ' '.
- Class missing a property named ' '. Did you mean one of ?
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/1ffeda4019776ca9.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/java/core/src/main/java/org/apache/beam/sdk/options/PipelineOptionsFactory.java:1458
throw new IllegalArgumentException(
String.format(
"Expected setter for property [%s] to not be marked with @%s on %s",
setter.descriptor.getName(),
annotationClass.getSimpleName(),
setter.settersWithTheAnnotationClassNames));
} else if (setters.size() > 1) {
StringBuilder builder =
new StringBuilder(
String.format("Found setters marked with @%s:", annotationClass.getSimpleName()));
for (AnnotatedSetter setter : setters) {
builder.append(
String.format(
"%n - Setter for property [%s] should not be marked with @%s on %s",
setter.descriptor.getName(),
annotationClass.getSimpleName(),
setter.settersWithTheAnnotationClassNames));
}
throw new IllegalArgumentException(builder.toString());
}
}
private static class MissingBeanMethod {
String methodType;
PropertyDescriptor property;
}
private static void throwForMissingBeanMethod(
Class<? extends PipelineOptions> iface, List<MissingBeanMethod> missingBeanMethods) {
if (missingBeanMethods.size() == 1) {
MissingBeanMethod missingBeanMethod = missingBeanMethods.get(0);
throw new IllegalArgumentException(
String.format(
"Expected %s for property [%s] of type [%s] on [%s].",
missingBeanMethod.methodType,
missingBeanMethod.property.getName(),
missingBeanMethod.property.getPropertyType().getName(),View on GitHub (pinned to 12126d8942)