bumptech/glide · error · IllegalArgumentException

Failed to find value for: {} from mirrors: {}

Error message

Failed to find value for: {} from mirrors: {}

What it means

Thrown by Glide's annotation processor in findClassValuesFromAnnotationOnClassAsNames() when an annotation (e.g. @Excludes) is matched by name on a class, has exactly one element-value entry, but entries.iterator().next().getValue() returns null. It means the processor located the right annotation mirror but could not extract a usable value from it.

Source

Thrown at annotation/compiler/src/main/java/com/bumptech/glide/annotation/compiler/ProcessorUtil.java:557

  ImmutableSet<String> findClassValuesFromAnnotationOnClassAsNames(
      Element clazz, Class<? extends Annotation> annotationClass) {
    String annotationClassName = annotationClass.getName();
    AnnotationValue excludedModuleAnnotationValue = null;
    for (AnnotationMirror annotationMirror : clazz.getAnnotationMirrors()) {
      // Two different AnnotationMirrors the same class might not be equal, so compare Strings
      // instead. This check is necessary because a given class may have multiple Annotations.
      if (!annotationClassName.equals(annotationMirror.getAnnotationType().toString())) {
        continue;
      }

      var entries = annotationMirror.getElementValues().entrySet();
      if (entries.size() != 1) {
        throw new IllegalArgumentException("Expected single value, but found: " + entries);
      }
      excludedModuleAnnotationValue = entries.iterator().next().getValue();
      if (excludedModuleAnnotationValue == null) {
        throw new IllegalArgumentException(
            "Failed to find value for: "
                + annotationClass
                + " from mirrors: "
                + clazz.getAnnotationMirrors());
      }
    }

    if (excludedModuleAnnotationValue == null) {
      return ImmutableSet.of();
    }

    Object value = excludedModuleAnnotationValue.getValue();
    if (value instanceof List) {
      LinkedHashSet<String> out = new LinkedHashSet<>();
      for (Object o : (List<?>) value) {
        AnnotationValue av = (AnnotationValue) o;
        out.add(qualifiedNameFromTypeMirror((TypeMirror) av.getValue()));
      }

View on GitHub (pinned to eb14a895d8)

Solutions

  1. Run a clean build (./gradlew clean assemble or Build > Clean Project) to eliminate stale/incremental annotation state, then rebuild.
  2. If using Lombok or another annotation rewriter, ensure it runs before Glide's processor in the kapt/ksp/processor ordering, or exclude the conflicting processor.
  3. Inspect the full annotation mirrors dump in the error message to confirm the annotation is the one you expect and is not being rewritten.
  4. If you maintain a custom @GlideModule, verify the annotation (e.g. @Excludes) is applied to resolvable classes and has the expected single value.
  5. Update the JDK / Kotlin compiler plugin to a stable release to rule out a javac annotation-mirror bug.

Example fix

// before
@GlideModule
@Excludes // <- missing value, or value rewriter nullified it
class MyModule : AppGlideModule()

// after
@GlideModule
@Excludes(SomeOtherModule::class)
class MyModule : AppGlideModule()
Defensive patterns

Strategy: validation

Validate before calling

// Before relying on an annotation value, confirm it resolves:
// (compile-time check) ensure the annotation is present with a non-empty single value.
@GlideModule
@Excludes(ExcludedModule::class) // explicit, resolvable class literal
class MyModule : AppGlideModule()

Prevention

When it happens

Trigger: The annotation processor iterates clazz.getAnnotationMirrors(), matches one whose type name equals the target annotation class, confirms it has a single entry, then reads that entry's value. If the returned AnnotationValue is null (a state a conforming javac should not normally produce), the check at line 556 fires.

Common situations: An edge case in annotation processing: a malformed/source-only annotation, an Lombok or other non-standard processor rewriting annotations before Glide's runs, or an annotation written with an unusual default. Most often seen with IDE incremental compilation or a JDK/javac version that exposes annotation mirrors differently. Rare in practice.

Related errors


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