{"record":{"id":"03ddf425f1ea0dfb","repo":"apache/beam","slug":"could-not-find-a-way-to-create-autovalue-class-descriptor","errorCode":null,"errorMessage":"Could not find a way to create AutoValue class <descriptor>","messagePattern":"Could not find a way to create AutoValue class <descriptor>","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/AutoValueSchema.java","lineNumber":135,"sourceCode":"          new DefaultTypeConversionsFactory());\n    }\n\n    // Try to find a generated builder class. If one exists, use that to generate a\n    // SchemaTypeCreator for creating AutoValue objects.\n    SchemaUserTypeCreator creatorFactory =\n        AutoValueUtils.getBuilderCreator(\n            targetTypeDescriptor, schema, AbstractGetterTypeSupplier.INSTANCE);\n    if (creatorFactory != null) {\n      return creatorFactory;\n    }\n\n    // If there is no builder, there should be a package-private constructor in the generated\n    // class. Use that for creating AutoValue objects.\n    creatorFactory =\n        AutoValueUtils.getConstructorCreator(\n            targetTypeDescriptor, schema, AbstractGetterTypeSupplier.INSTANCE);\n    if (creatorFactory == null) {\n      throw new RuntimeException(\n          \"Could not find a way to create AutoValue class \" + targetTypeDescriptor);\n    }\n\n    return creatorFactory;\n  }\n\n  @Override\n  public <T> @Nullable Schema schemaFor(TypeDescriptor<T> typeDescriptor) {\n    return JavaBeanUtils.schemaFromJavaBeanClass(\n        typeDescriptor, AbstractGetterTypeSupplier.INSTANCE);\n  }\n}\n","sourceCodeStart":117,"sourceCodeEnd":148,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/AutoValueSchema.java#L117-L148","documentation":"AutoValueSchema.schemaTypeCreator needs a way to construct instances of the AutoValue class: either a generated Builder or a package-private constructor in the generated AutoValue_Foo class. When getConstructorCreator returns null for both, Beam cannot map rows back into the class and throws this error.","triggerScenarios":"Using AutoValueSchema for a type whose generated AutoValue_ class exposes neither a builder nor a constructor the creator-factory lookup recognizes — e.g. the class isn't actually an @AutoValue class (descriptor points at the abstract class), code generation failed, or beam-schemas can't see the generated constructor via the AbstractGetterTypeSupplier.","commonSituations":"Forgetting the @AutoValue annotation so no AutoValue_Foo class was generated; annotation processing disabled in the build; nested/private AutoValue classes; shaded or relocated generated classes invisible at runtime; using interfaces annotated @AutoValue incorrectly.","solutions":["Verify the class is annotated @AutoValue and AutoValue_Foo is generated (check target/generated-sources or build output).","Clean rebuild to ensure annotation processing ran; enable annotationProcessorPaths in Maven/Gradle if missing.","Add an explicit @AutoValue.Builder to the class so Beam can use the builder creator path.","Avoid private/nested or shaded AutoValue classes for schema rows."],"exampleFix":"// before\npublic abstract class Foo { public abstract String getName(); }\n\n// after\n@AutoValue public abstract class Foo {\n  public abstract String getName();\n  @AutoValue.Builder public abstract static class Builder {}\n}","handlingStrategy":"validation","validationCode":"if (!targetType.isAnnotationPresent(AutoValue.class)) throw new IllegalStateException(targetType + \" is not an @AutoValue class\");","typeGuard":"static boolean hasAutoValueImplementation(Class<?> c) {\n  try { Class.forName(c.getName() + \"$\"); return false; } // not an AutoValue shape\n  catch (ClassNotFoundException e) { }\n  try { Class.forName(c.getName() + \"$Builder\"); return true; }\n  catch (ClassNotFoundException e) { return false; } // relies on ctor path\n}","tryCatchPattern":"try { schema = Schema.of(MyAutoValue.class); }\ncatch (RuntimeException e) {\n  if (e.getMessage().contains(\"Could not find a way to create AutoValue class\")) {\n    throw new IllegalStateException(\"Ensure @AutoValue processing ran and a Builder or ctor exists\", e);\n  } throw e;\n}","preventionTips":["Annotate row classes with @AutoValue and add @AutoValue.Builder","Verify annotationProcessorPaths in Maven/Gradle","Avoid shaded or deeply nested AutoValue row classes"],"tags":["autovalue","schema","annotation-processing"],"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-20T03:17:13.778Z"}