apache/beam · error · IllegalStateException
AutoValue generated class not found: ${generatedClassName}
Error message
AutoValue generated class not found: ${generatedClassName} What it means
AutoValueUtils maps a user @AutoValue class to its AutoValue-generated implementation class by name convention (AutoValue_<...>). getAutoValueGenerated loads that class reflectively and throws IllegalStateException when Class.forName cannot find the generated class — typically because annotation processing didn't run or the generated class isn't on the runtime classpath.
Source
Thrown at sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/utils/AutoValueUtils.java:111
TypeDescriptor<?> typeDescriptor) {
if (!typeDescriptor.getRawType().getName().contains(AUTO_VALUE_GENERATED_PREFIX)) {
// fast path for types which aren't autogenerated
return typeDescriptor;
}
// AutoValue extensions may be nested
TypeDescriptor<?> firstGeneratedTypeDescriptor = findFirstGeneratedAutoValue(typeDescriptor);
return Optional.ofNullable(firstGeneratedTypeDescriptor.getRawType().getSuperclass())
.map(superClass -> firstGeneratedTypeDescriptor.getSupertype((Class) superClass))
.orElse(null);
}
@SuppressWarnings("unchecked")
public static TypeDescriptor<?> getAutoValueGenerated(TypeDescriptor<?> typeDescriptor) {
String generatedClassName = getAutoValueGeneratedName(typeDescriptor.getRawType().getName());
try {
return typeDescriptor.getSubtype((Class) Class.forName(generatedClassName));
} catch (ClassNotFoundException e) {
throw new IllegalStateException("AutoValue generated class not found: " + generatedClassName);
}
}
public static @Nullable TypeDescriptor<?> getAutoValueGeneratedBuilder(
TypeDescriptor<?> typeDescriptor) {
TypeDescriptor generated = getAutoValueGenerated(typeDescriptor);
TypeDescriptor firstGenerated = findFirstGeneratedAutoValue(generated);
String builderName = firstGenerated.getRawType().getName() + "$Builder";
try {
Class builderClass = Class.forName(builderName);
Type genericSuperClass = builderClass.getGenericSuperclass();
if (builderClass.getTypeParameters().length != 0 && genericSuperClass != null) {
// we need to get hold of a parameterized type version of the builder class - here's one way
// of doing it:
TypeDescriptor resolved = TypeDescriptor.of(genericSuperClass).getSubtype(builderClass);
for (int i = 0; i < builderClass.getTypeParameters().length; i++) {
TypeVariable typeVariable = builderClass.getTypeParameters()[i];
Type actualType =View on GitHub (pinned to 12126d8942)
Solutions
- Ensure AutoValue annotation processing is enabled in the build (remove -proc:none, configure the annotationProcessorPath)
- Add com.google.auto.value:auto-value to the annotationProcessorPath/processor path
- Verify the AutoValue_<Class> class exists in the deployed artifact
- Use beam-sdks-java-extensions-avro/autovalue service-compatible Beam version and check shading includes generated classes
Example fix
// before <annotationProcessorPaths><!-- autovalue missing --></annotationProcessorPaths> // after <annotationProcessorPaths> <path><groupId>com.google.auto.value</groupId><artifactId>auto-value</artifactId><version>1.10.4</version></path> </annotationProcessorPaths>
Defensive patterns
Strategy: try-catch
Validate before calling
try { Class.forName("AutoValue_" + type.getRawType().getName()); }
catch (ClassNotFoundException e) { throw new IllegalStateException("AutoValue processing not enabled for " + type); } Type guard
boolean hasAutoValueGenerated(Class<?> c) {
try { Class.forName("AutoValue_" + c.getName()); return true; } catch (ClassNotFoundException e) { return false; }
} Try / catch
try { TypeDescriptor<?> g = AutoValueUtils.getAutoValueGenerated(td); }
catch (IllegalStateException e) { /* fall back to reflection/manual schema */ } Prevention
- Enable AutoValue annotation processing in all build profiles
- Verify generated classes survive shading/minification
- Add a build-time check that AutoValue_ classes exist
When it happens
Trigger: Calling getAutoValueGenerated (directly or via generated/generatedTypeDescriptor) on a TypeDescriptor whose raw type is an @AutoValue class for which no AutoValue_... class exists at runtime.
Common situations: Building with annotation processing disabled (e.g. -proc:none); AutoValue dependency missing from the annotation processor path; shaded/prod jar that stripped generated classes; running in an environment where the generated class was compiled in a different artifact.
Related errors
- Scheme: [%s] has conflicting filesystems: [%s]
- Class '%s' does not implement PipelineRunner. Supported pipe
- Unknown 'runner' specified '%s', supported pipeline runners
- AutoValue builder class ${builderTypeDescriptor} did not con
- Failed to locate required method ${className}.${methodName}
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/99e98f6f04bdc05e.
Report an issue: GitHub.