apache/beam · error · IllegalArgumentException

Expected for property [ ] of type [ ] on [ ].

Error message

Expected %s for property [%s] of type [%s] on [%s].

What it means

Thrown when a PipelineOptions interface declares one half of a bean property but not the other: e.g. a getter exists without a matching setter (or vice versa) of the required type. Beam's proxy needs both accessors (getters are mandatory; setters as applicable) to implement the property, so it reports exactly which bean method type, property name, property type, and interface are incomplete.

Solutions

  1. Add the missing bean method named in the message ('getter' or 'setter') with the exact property type given.
  2. If the property type was changed, update the counterpart accessor to match it.
  3. Remove the orphan accessor if the property is not actually needed.

Example fix

// before
String getFoo(); // no setter
// after
String getFoo();
void setFoo(String value);
Defensive patterns

Strategy: validation

Validate before calling

java.beans.Introspector.getBeanInfo(MyOptions.class).getPropertyDescriptors();
for (java.beans.PropertyDescriptor pd : java.beans.Introspector.getBeanInfo(MyOptions.class).getPropertyDescriptors()) {
  boolean hasGet = pd.getReadMethod() != null, hasSet = pd.getWriteMethod() != null;
  if (hasGet != hasSet) {
    System.err.println("Property " + pd.getName() + " missing " + (hasGet ? "setter" : "getter"));
  }
}

Try / catch

try {
  PipelineOptionsFactory.fromArgs(args).as(MyOptions.class);
} catch (IllegalArgumentException e) {
  if (e.getMessage().startsWith("Expected getter") || e.getMessage().startsWith("Expected setter")) { /* add the missing accessor */ }
  throw e;
}

Prevention

When it happens

Trigger: PipelineOptionsFactory.fromArgs(...).as(iface.class) when throwForMissingBeanMethod finds a MissingBeanMethod: property 'foo' of type java.lang.String on iface has a getter but no 'void setFoo(String)' (or a setter without a getter).

Common situations: Adding a getter for a read-only-looking property and forgetting Beam requires setters for mutable options; renaming a setter's parameter type so it no longer matches the getter's property type; incomplete copy of an accessor pair.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/5307a9436ea49049. Report an issue: GitHub.

Appendix: source

Thrown at sdks/java/core/src/main/java/org/apache/beam/sdk/options/PipelineOptionsFactory.java:1471

                "%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(),
              iface.getName()));
    } else if (missingBeanMethods.size() > 1) {
      StringBuilder builder =
          new StringBuilder(
              String.format("Found missing property methods on [%s]:", iface.getName()));
      for (MissingBeanMethod method : missingBeanMethods) {
        builder.append(
            String.format(
                "%n  - Expected %s for property [%s] of type [%s]",
                method.methodType,
                method.property.getName(),
                method.property.getPropertyType().getName()));
      }

View on GitHub (pinned to 12126d8942)