bumptech/glide · error · IllegalArgumentException

Unrecognized type: {}

Error message

Unrecognized type: {}

What it means

IndexerGenerator.generate partitions incoming TypeElements into modules (LibraryGlideModule) and extensions (GlideExtension). Any element that is neither — detected via processorUtil.isExtension / processorUtil.isLibraryGlideModule — is treated as a programming/internal error and rejected. This path is reached from the indexer lookup, not from user annotations directly, so a hit usually means a class was misclassified or the indexer was fed an unexpected type.

Source

Thrown at annotation/compiler/src/main/java/com/bumptech/glide/annotation/compiler/IndexerGenerator.java:67

final class IndexerGenerator {
  private static final String INDEXER_NAME_PREFIX = "GlideIndexer_";
  private static final int MAXIMUM_FILE_NAME_LENGTH = 255;
  private final ProcessorUtil processorUtil;

  IndexerGenerator(ProcessorUtil processorUtil) {
    this.processorUtil = processorUtil;
  }

  TypeSpec generate(List<TypeElement> types) {
    List<TypeElement> modules = new ArrayList<>();
    List<TypeElement> extensions = new ArrayList<>();
    for (TypeElement element : types) {
      if (processorUtil.isExtension(element)) {
        extensions.add(element);
      } else if (processorUtil.isLibraryGlideModule(element)) {
        modules.add(element);
      } else {
        throw new IllegalArgumentException("Unrecognized type: " + element);
      }
    }
    if (!modules.isEmpty() && !extensions.isEmpty()) {
      throw new IllegalArgumentException(
          "Given both modules and extensions, expected one or the "
              + "other. Modules: "
              + modules
              + " Extensions: "
              + extensions);
    }
    if (!modules.isEmpty()) {
      return generate(types, GlideModule.class);
    } else {
      return generate(types, GlideExtension.class);
    }
  }

  private TypeSpec generate(

View on GitHub (pinned to eb14a895d8)

Solutions

  1. Clean the build outputs and rebuild (`./gradlew clean`).
  2. Remove any checked-in generated Indexer_*.java classes from source control.
  3. Align Glide versions across all modules (annotation, compiler, library, integration AARs) so indexer formats agree.
  4. If it persists, identify the offending class in the message and remove or re-annotate it correctly.
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: IndexerGenerator.generate loops over `types`; for each element, `if (isExtension) extensions.add else if (isLibraryGlideModule) modules.add else throw`. Hit when an indexer entry points at a class that is neither @GlideExtension-annotated nor a LibraryGlideModule subclass (e.g. a stale indexer from an older Glide version, a manually edited Indexer, or a corrupted incremental cache).

Common situations: Upgrading Glide across versions where the indexer format changed; stale generated Indexer classes left in build/ or in a checked-in generated source set; an AAR bundled with an outdated Indexer; incremental/KAPT cache corruption.

Related errors


AI-assisted analysis of bumptech/glide@eb14a895d8 (2026-08-14). Data as JSON: /api/errors/bba37709c933c1d2. Report an issue: GitHub.