{"record":{"id":"c1b6be60393e2f8e","repo":"bumptech/glide","slug":"expected-single-value-but-found","errorCode":null,"errorMessage":"Expected single value, but found: {}","messagePattern":"Expected single value, but found: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"annotation/compiler/src/main/java/com/bumptech/glide/annotation/compiler/ProcessorUtil.java","lineNumber":553,"sourceCode":"        .filter(new FilterPublicMethods((TypeMirror) null /*returnType*/, MethodType.STATIC))\n        .transform(new ToMethod())\n        .toList();\n  }\n\n  ImmutableSet<String> findClassValuesFromAnnotationOnClassAsNames(\n      Element clazz, Class<? extends Annotation> annotationClass) {\n    String annotationClassName = annotationClass.getName();\n    AnnotationValue excludedModuleAnnotationValue = null;\n    for (AnnotationMirror annotationMirror : clazz.getAnnotationMirrors()) {\n      // Two different AnnotationMirrors the same class might not be equal, so compare Strings\n      // instead. This check is necessary because a given class may have multiple Annotations.\n      if (!annotationClassName.equals(annotationMirror.getAnnotationType().toString())) {\n        continue;\n      }\n\n      var entries = annotationMirror.getElementValues().entrySet();\n      if (entries.size() != 1) {\n        throw new IllegalArgumentException(\"Expected single value, but found: \" + entries);\n      }\n      excludedModuleAnnotationValue = entries.iterator().next().getValue();\n      if (excludedModuleAnnotationValue == null) {\n        throw new IllegalArgumentException(\n            \"Failed to find value for: \"\n                + annotationClass\n                + \" from mirrors: \"\n                + clazz.getAnnotationMirrors());\n      }\n    }\n\n    if (excludedModuleAnnotationValue == null) {\n      return ImmutableSet.of();\n    }\n\n    Object value = excludedModuleAnnotationValue.getValue();\n    if (value instanceof List) {\n      LinkedHashSet<String> out = new LinkedHashSet<>();","sourceCodeStart":535,"sourceCodeEnd":571,"githubUrl":"https://github.com/bumptech/glide/blob/eb14a895d8f866e6a08c3e19d50ea3bd2c12c20a/annotation/compiler/src/main/java/com/bumptech/glide/annotation/compiler/ProcessorUtil.java#L535-L571","documentation":"ProcessorUtil.findClassValuesFromAnnotationOnClassAsNames (used to read @Excludes and similar single-value class-array annotations) expects the matched AnnotationMirror to expose exactly one element value (the `value()` member). If the mirror has zero or more than one element-value entry, the processor cannot decide which entry holds the class list and throws defensively.","triggerScenarios":"ProcessorUtil: iterates clazz.getAnnotationMirrors(); for the mirror whose type matches annotationClass.getName(), reads `annotationMirror.getElementValues().entrySet()`; throws when `entries.size() != 1`. Most plausibly hit with @Excludes when the annotation is applied without a value (relying on a default) or when an exotic/derived annotation exposes multiple members and matches the looked-up name.","commonSituations":"Writing `@Excludes` with no `value = {...}` (the member is required, but a malformed/IDE-assisted declaration can confuse the mirror); a custom annotation that collides in name and exposes multiple members; a Kotlin annotation-use-site quirk that emits an empty value set; edge cases with certain Kotlin/KAPT metadata.","solutions":["Always supply the value member explicitly: `@Excludes({SomeModule.class, OtherModule.class})`.","If excluding a single module, still use array syntax: `@Excludes(SomeModule.class)`.","Ensure no other annotation on the same class shares the fully-qualified name being looked up.","Upgrade Kotlin/KAPT and glide:compiler — annotation-mirror iteration edge cases are usually fixed upstream."],"exampleFix":"// before\n@Excludes\npublic class MyAppGlideModule extends AppGlideModule { ... }\n\n// after\n@Excludes({SomeLibraryModule.class})\npublic class MyAppGlideModule extends AppGlideModule { ... }","handlingStrategy":"validation","validationCode":"@Test void excludesAnnotationHasSingleValueMember() {\n  Excludes ex = MyAppGlideModule.class.getAnnotation(Excludes.class);\n  if (ex != null) {\n    // The annotation declares exactly one member (value()); ensure it is populated.\n    assertTrue(\"@Excludes must list at least one module\", ex.value().length > 0);\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always supply `value = { ... }` (or the single-class shorthand) on @Excludes.","Keep Kotlin/KAPT and glide:compiler versions aligned to avoid annotation-mirror quirks.","Avoid placing other annotations whose fully-qualified name could collide with @Excludes on the same class."],"tags":["glide","annotation-processing","excludes","annotation-value","internal"],"backgroundTag":null,"analyzedSha":"eb14a895d8f866e6a08c3e19d50ea3bd2c12c20a","analyzedAt":"2026-08-14T01:43:54.821Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}