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

  1. Ensure AutoValue annotation processing is enabled in the build (remove -proc:none, configure the annotationProcessorPath)
  2. Add com.google.auto.value:auto-value to the annotationProcessorPath/processor path
  3. Verify the AutoValue_<Class> class exists in the deployed artifact
  4. 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

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


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