apache/beam · error · RuntimeException

Standard logical type '%s' does not have a static of('%s') m

Error message

Standard logical type '%s' does not have a static of('%s') method.

What it means

When decoding a standard logical type (identified by URN) that takes an argument, SchemaTranslation reflectively invokes the static of(bootstrapValue) method; if the class has no such static method it throws RuntimeException with 'does not have a static of(...) method'.

Source

Thrown at sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/SchemaTranslation.java:427

              clazz = ClassUtils.wrapperToPrimitive(clazz);
            } else if (fieldValue instanceof List) {
              // argument is ArrayValue or iterableValue
              clazz = List.class;
            }
            if (fieldValue instanceof Map) {
              // argument is Map
              clazz = Map.class;
            } else if (fieldValue instanceof Row) {
              // argument is Row
              clazz = Row.class;
            }
            String objectName = clazz.getName();
            try {
              return FieldType.logicalType(
                  logicalTypeClass.cast(
                      logicalTypeClass.getMethod("of", clazz).invoke(null, fieldValue)));
            } catch (NoSuchMethodException e) {
              throw new RuntimeException(
                  String.format(
                      "Standard logical type '%s' does not have a static of('%s') method.",
                      urn, objectName),
                  e);
            } catch (IllegalAccessException e) {
              throw new RuntimeException(
                  String.format(
                      "Standard logical type '%s' has an of('%s') method, but it is not accessible.",
                      urn, objectName),
                  e);
            } catch (InvocationTargetException e) {
              throw new RuntimeException(
                  String.format(
                      "Error instantiating logical type '%s' with of('%s') method.",
                      urn, objectName),
                  e);
            }
          } else {

View on GitHub (pinned to 12126d8942)

Solutions

  1. Add/restore a public static of(<argType>) method on the logical type class matching the serialized argument type.
  2. Ensure the URN-to-class mapping (LogicalTypes registrar) points to the right class.
  3. Make the logical type implement the same interface/version as when encoded; align SDK versions.
  4. Catch the RuntimeException around schema/row decode and fail gracefully per record.

Example fix

// before
class MyLogicalType { public MyLogicalType(String v){...} }
// after
class MyLogicalType implements LogicalType<String,String> {
  public static MyLogicalType of(String v){ return new MyLogicalType(v); }
}
Defensive patterns

Strategy: validation

Validate before calling

Class<?> lt = logicalTypeClass;
boolean ok = java.util.Arrays.stream(lt.getMethods())
    .anyMatch(m -> m.getName().equals("of") && m.getParameterCount() == 1
        && java.lang.reflect.Modifier.isStatic(m.getModifiers()));
if (!ok) throw new IllegalStateException("Logical type missing static of()");

Prevention

When it happens

Trigger: Decoding a LogicalType field whose URN maps to a class lacking a static of(<argumentType>) factory, or whose argument type does not match of()'s parameter.

Common situations: Custom LogicalType implementations serialized across jobs; renamed/refactored factory methods; argument type changed (e.g. string vs enum) between writer and reader versions.

Related errors


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