{"record":{"id":"12517734501addb6","repo":"apache/beam","slug":"unable-to-generate-a-creator-for-with-schema","errorCode":null,"errorMessage":"Unable to generate a creator for {} with schema {}","messagePattern":"Unable to generate a creator for (.+?) with schema (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/utils/JavaBeanUtils.java","lineNumber":416,"sourceCode":"              .method(ElementMatchers.named(\"create\"))\n              .intercept(\n                  new StaticFactoryMethodInstruction(\n                      types, clazz, creator, typeConversionsFactory));\n\n      return builder\n          .visit(new AsmVisitorWrapper.ForDeclaredMethods().writerFlags(ClassWriter.COMPUTE_FRAMES))\n          .make()\n          .load(\n              ReflectHelpers.findClassLoader(clazz.getClassLoader()),\n              getClassLoadingStrategy(clazz))\n          .getLoaded()\n          .getDeclaredConstructor()\n          .newInstance();\n    } catch (InstantiationException\n        | IllegalAccessException\n        | NoSuchMethodException\n        | InvocationTargetException e) {\n      throw new RuntimeException(\n          \"Unable to generate a creator for \" + clazz + \" with schema \" + schema);\n    }\n  }\n\n  public static <T, K extends Comparable<? super K>> Comparator<T> comparingNullFirst(\n      Function<? super T, ? extends @Nullable K> keyExtractor) {\n    return Comparator.comparing(keyExtractor, Comparator.nullsFirst(Comparator.naturalOrder()));\n  }\n\n  // Implements a method to read a public getter out of an object.\n  private static class InvokeGetterInstruction implements Implementation {\n    private final FieldValueTypeInformation typeInformation;\n    private final TypeConversionsFactory typeConversionsFactory;\n\n    InvokeGetterInstruction(\n        FieldValueTypeInformation typeInformation, TypeConversionsFactory typeConversionsFactory) {\n      this.typeInformation = typeInformation;\n      this.typeConversionsFactory = typeConversionsFactory;","sourceCodeStart":398,"sourceCodeEnd":434,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/utils/JavaBeanUtils.java#L398-L434","documentation":"JavaBeanUtils.createStaticCreator generates a SchemaUserTypeCreator backed by a static factory method. When the generated creator class cannot be instantiated reflectively (InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException), this RuntimeException naming the class and schema is thrown.","triggerScenarios":"Calling JavaBeanUtils.getStaticCreator/createStaticCreator where the class hosting the static creator method is abstract, not accessible, or lacks a no-arg constructor required to load the generated proxy class.","commonSituations":"Registering a schema type whose static builder/factory method lives in a package-private or abstract class; classpath/classloader differences in distributed runners preventing reflective instantiation.","solutions":["Ensure the class containing the static creator is public and concrete with a public no-arg constructor","Verify the static method signature matches what the schema creator expects","Inspect the chained cause for the exact reflective failure","Use getConstructorCreator instead if a constructor-based creator fits better"],"exampleFix":"// before\nabstract class MyFactories { public static MyType create(...) {...} }\n// after\npublic class MyFactories { public static MyType create(...) {...} }","handlingStrategy":"validation","validationCode":"static void checkStaticCreatorHost(Class<?> host) {\n  if (java.lang.reflect.Modifier.isAbstract(host.getModifiers()) || !java.lang.reflect.Modifier.isPublic(host.getModifiers()))\n    throw new IllegalArgumentException(host + \" must be public and concrete\");\n  try { host.getDeclaredConstructor(); }\n  catch (NoSuchMethodException e) { throw new IllegalArgumentException(host + \" lacks a public no-arg constructor\", e); }\n}","typeGuard":"static boolean supportsStaticCreator(Class<?> host) {\n  return java.lang.reflect.Modifier.isPublic(host.getModifiers())\n      && !java.lang.reflect.Modifier.isAbstract(host.getModifiers());\n}","tryCatchPattern":"try {\n  creator = JavaBeanUtils.getStaticCreator(TypeDescriptor.of(MyType.class), schema, MyType.class.getMethod(\"create\", ...), options);\n} catch (RuntimeException e) {\n  throw new IllegalStateException(\"Static creator generation failed: \" + e.getMessage(), e);\n}","preventionTips":["Host static creator methods in public concrete classes","Keep the static factory signature stable and matching the schema","Add unit tests that build creators for all schema types before pipeline submission"],"tags":["java","reflection","schemas","code-generation"],"backgroundTag":"internal-invariant-violation","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}