{"record":{"id":"668e20a529d7688e","repo":"apache/beam","slug":"unable-to-generate-a-creator-for-class-builderclass-with","errorCode":null,"errorMessage":"Unable to generate a creator for class ${builderClass} with schema ${schema}","messagePattern":"Unable to generate a creator for class (.+?) with schema (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/utils/AutoValueUtils.java","lineNumber":306,"sourceCode":"      DynamicType.Builder<SchemaUserTypeCreator> builder =\n          BYTE_BUDDY\n              .with(new InjectPackageStrategy(builderClass))\n              .subclass(SchemaUserTypeCreator.class)\n              .method(ElementMatchers.named(\"create\"))\n              .intercept(\n                  new BuilderCreateInstruction(types, setterMethods, builderClass, buildMethod));\n      return builder\n          .visit(new ForDeclaredMethods().writerFlags(ClassWriter.COMPUTE_FRAMES))\n          .make()\n          .load(ReflectHelpers.findClassLoader(), getClassLoadingStrategy(builderClass))\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 class \" + builderClass + \" with schema \" + schema);\n    }\n  }\n\n  static class BuilderCreateInstruction implements Implementation {\n    private final List<FieldValueTypeInformation> setters;\n    private final Class<?> builderClass;\n    private final Method buildMethod;\n\n    BuilderCreateInstruction(\n        List<FieldValueTypeInformation> types,\n        List<FieldValueTypeInformation> setters,\n        Class<?> builderClass,\n        Method buildMethod) {\n      this.setters = setters;\n      this.builderClass = builderClass;\n      this.buildMethod = buildMethod;\n    }","sourceCodeStart":288,"sourceCodeEnd":324,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/utils/AutoValueUtils.java#L288-L324","documentation":"AutoValueUtils wraps a failure to reflectively instantiate an AutoValue builder (or generate its ByteBuddy creator) into a RuntimeException. When the builder class cannot be constructed via its no-arg declared constructor, Beam cannot map rows to the AutoValue type and aborts. This is almost always a class-loading or compilation issue with the generated builder class.","triggerScenarios":"Calling getBuilderCreator for an AutoValue class whose Builder cannot be instantiated with getDeclaredConstructor().newInstance() — e.g. the Builder class exists but throws in a static initializer or constructor, has no accessible no-arg constructor, or fails to load at runtime.","commonSituations":"AutoValue-generated code is missing or stale (annotation processing didn't run or ran against an older schema); the builder constructor throws (validation in constructor); running on a classpath where the generated classes weren't shaded/relocated correctly; serialized pipeline references a class absent on workers.","solutions":["Verify AutoValue annotation processing is enabled and the Builder class is generated (rebuild the project, check for compile errors from AutoValue).","Ensure the Builder has an accessible no-arg constructor; AutoValue Builders normally do — remove any constructor that breaks instantiation.","Check that the builder constructor body doesn't throw (any exception during newInstance is wrapped here).","Confirm the same class version exists on all workers (use --filesToStage or shaded jar) so reflection doesn't fail remotely."],"exampleFix":"// before: class compiled without annotation processing\n// MyAutoValue.Builder.class not generated -> reflection fails\n// after: enable annotation processor in build\nmaven-compiler-plugin: <annotationProcessorPaths><path>com.google.auto.value:auto-value</path></annotationProcessorPaths>","handlingStrategy":"try-catch","validationCode":"try { Class.forName(\"com.example.MyAutoValue$Builder\").getDeclaredConstructor().newInstance(); } catch (Throwable t) { /* builder not generatable */ }","typeGuard":null,"tryCatchPattern":"try { creator = AutoValueUtils.getBuilderCreator(cls, schema); } catch (RuntimeException e) { /* rebuild with annotation processing / log builderClass */ }","preventionTips":["Always run annotation processing (AutoValue) in CI so missing builders fail at compile time.","Keep generated class versions identical across driver and workers.","Avoid side-effectful logic in builder constructors."],"tags":["java","reflection","autovalue","schema"],"backgroundTag":"class-not-found","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"}