apache/beam · error · java.lang.RuntimeException

Cannot create creator for ${targetTypeDescriptor}

Error message

Cannot create creator for ${targetTypeDescriptor}

What it means

ProtoMessageSchema.schemaTypeCreator builds a ByteBuddy-based creator to instantiate proto builder objects for Row conversion. If ProtoByteBuddyUtils.getBuilderCreator returns null — meaning no suitable builder creator could be generated for the target type/schema — this RuntimeException is thrown.

Source

Thrown at sdks/java/extensions/protobuf/src/main/java/org/apache/beam/sdk/extensions/protobuf/ProtoMessageSchema.java:122

        new ProtoClassFieldValueTypeSupplier(),
        new ProtoTypeConversionsFactory());
  }

  @Override
  public List<FieldValueTypeInformation> fieldValueTypeInformations(
      TypeDescriptor<?> targetTypeDescriptor, Schema schema) {
    return JavaBeanUtils.getFieldTypes(
        targetTypeDescriptor, schema, new ProtoClassFieldValueTypeSupplier());
  }

  @Override
  public SchemaUserTypeCreator schemaTypeCreator(
      TypeDescriptor<?> targetTypeDescriptor, Schema schema) {
    SchemaUserTypeCreator creator =
        ProtoByteBuddyUtils.getBuilderCreator(
            targetTypeDescriptor, schema, new ProtoClassFieldValueTypeSupplier());
    if (creator == null) {
      throw new RuntimeException("Cannot create creator for " + targetTypeDescriptor);
    }
    return creator;
  }

  // Other modules are not allowed to use non-vendored Message class
  @SuppressWarnings({
    "rawtypes", // TODO(https://github.com/apache/beam/issues/20447)
    "unchecked"
  })
  public static <T> SimpleFunction<byte[], Row> getProtoBytesToRowFn(Class<T> clazz) {
    Class<Message> protoClass = ensureMessageType(clazz);
    ProtoCoder<Message> protoCoder = ProtoCoder.of(protoClass);
    return RowMessages.bytesToRowFn(
        new ProtoMessageSchema(),
        TypeDescriptor.of(protoClass),
        bytes -> protoCoder.getParser().parseFrom(bytes));
  }

View on GitHub (pinned to 12126d8942)

Solutions

  1. Verify the target type is a protobuf-generated Message with a Builder class.
  2. Check for proto field types unsupported by Beam's proto-to-Row mapping and simplify/annotate them.
  3. Regenerate proto code with a compatible protoc version.
  4. Enable ByteBuddy access to JDK internals (--add-opens) if running on newer JDKs.

Example fix

// before
schemaRegistry.registerTypeDescriptor(SomeNonProtoPojo.class);
// after
schemaRegistry.registerTypeDescriptor(MyGeneratedProtoMessage.class);
Defensive patterns

Strategy: try-catch

Validate before calling

if (!GeneratedMessageV3.Builder.class.isAssignableFrom(builderClass)) {
  throw new IllegalArgumentException("no builder for " + targetTypeDescriptor);
}

Try / catch

try { creator = schema.schemaTypeCreator(type, schema); } catch (RuntimeException e) { log.error("builder creator failed for {}: {}", type, e.getMessage(), e); }

Prevention

When it happens

Trigger: Calling schemaTypeCreator (via Schema translation for a proto class) where the target type has no matching protobuf builder type for the schema fields, e.g. unsupported field types or a type that is not a generated message with a Builder.

Common situations: Using ProtoMessageSchema with classes that don't follow generated protobuf code conventions; proto field types unsupported by Beam's schema mapping; ByteBuddy unable to generate the proxy due to classloader/JDK module restrictions.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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