apache/beam · error · IllegalArgumentException

Method ${creator} is not static

Error message

Method ${creator} is not static

What it means

The ByteBuddy static-method creator implementation requires the annotated creator method to be static, because it will invoke the method without an instance. When a @SchemaCreate-style creator method is an instance method, the constructor throws IllegalArgumentException. The creator must be callable as a pure factory.

Source

Thrown at sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/utils/ByteBuddyUtils.java:1554

  }

  /**
   * Invokes a static factory method registered using SchemaCreate. As the method parameters might
   * not be in the same order as the schema fields, reorders the parameters as necessary before
   * calling the constructor.
   */
  static class StaticFactoryMethodInstruction extends InvokeUserCreateInstruction {
    private final Method creator;

    StaticFactoryMethodInstruction(
        List<FieldValueTypeInformation> fields,
        Class<?> targetClass,
        Method creator,
        TypeConversionsFactory typeConversionsFactory) {
      super(
          fields, targetClass, Lists.newArrayList(creator.getParameters()), typeConversionsFactory);
      if (!Modifier.isStatic(creator.getModifiers())) {
        throw new IllegalArgumentException("Method " + creator + " is not static");
      }
      this.creator = creator;
    }

    @Override
    public InstrumentedType prepare(InstrumentedType instrumentedType) {
      return instrumentedType;
    }

    @Override
    protected StackManipulation afterPushingParameters() {
      return MethodInvocation.invoke(new ForLoadedMethod(creator));
    }
  }

  static class InvokeUserCreateInstruction implements Implementation {
    protected final List<FieldValueTypeInformation> fields;
    protected final Class<?> targetClass;

View on GitHub (pinned to 12126d8942)

Solutions

  1. Add the static modifier to the creator method.
  2. Use a different, static factory method as the creator.
  3. If the creator needs instance state, restructure: use a builder type or a static method taking all fields as parameters.

Example fix

// before
public MyClass fromSchema(String a, int b) { return new MyClass(a, b); }
// after
public static MyClass fromSchema(String a, int b) { return new MyClass(a, b); }
Defensive patterns

Strategy: validation

Validate before calling

if (!java.lang.reflect.Modifier.isStatic(creatorMethod.getModifiers())) throw new IllegalArgumentException("Creator must be static: " + creatorMethod);

Prevention

When it happens

Trigger: Marking a non-static (instance) method as a schema creator/factory for a class used in a schema — e.g. a method annotated for from-row conversion that lacks the static modifier.

Common situations: Refactoring a static factory into an instance method while forgetting to update schema annotations; copying a factory example but dropping 'static'; using a builder method instead of a static factory as creator.

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


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