{"record":{"id":"11e64e76fe3c9c2d","repo":"bazelbuild/bazel","slug":"no-member-s-of-the-s-annotation-found-for-elemen","errorCode":null,"errorMessage":"No member %s of the %s annotation found for element.","messagePattern":"No member (.+?) of the (.+?) annotation found for element\\.","errorType":"validation","errorClass":"OptionProcessorException","httpStatus":null,"severity":"error","filePath":"src/main/java/com/google/devtools/common/options/processor/ProcessorUtils.java","lineNumber":95,"sourceCode":"        elementUtils.getElementValuesWithDefaults(annotation).entrySet()) {\n      if (entry.getKey().getSimpleName().contentEquals(fieldName)) {\n        Object annotationField = entry.getValue().getValue();\n        if (!(annotationField instanceof DeclaredType)) {\n          throw new IllegalStateException(\n              String.format(\n                  \"The fieldName provided should only apply to Class<> type annotation fields, \"\n                      + \"but the field's value (%s) couldn't get cast to a DeclaredType\",\n                  entry));\n        }\n        String qualifiedName =\n            ((TypeElement) ((DeclaredType) annotationField).asElement())\n                .getQualifiedName()\n                .toString();\n        return elementUtils.getTypeElement(qualifiedName);\n      }\n    }\n    // Annotation missing the requested field.\n    throw new OptionProcessorException(\n        null, \"No member %s of the %s annotation found for element.\", fieldName, annotation);\n  }\n}\n","sourceCodeStart":77,"sourceCodeEnd":99,"githubUrl":"https://github.com/bazelbuild/bazel/blob/e6e199d0601a244511b4cf18c8b2828aa73db1fd/src/main/java/com/google/devtools/common/options/processor/ProcessorUtils.java#L77-L99","documentation":"Thrown while reading a Class<>-typed field out of an AnnotationMirror: the processor iterated every entry of the annotation mirror's values and none had the requested member name. It means the annotation instance on the element does not define that member — typically because the annotation class version known to the compiler differs from the one the processor was compiled against.","triggerScenarios":"Calling the Class<>-field extraction helper with a fieldName that the annotation type does not declare; annotation defaults changed/renamed between the processor's compiled view and the source being processed; annotation applied with an older definition that lacked the member.","commonSituations":"Upgrading the options library while an old jar with the previous annotation definition stays on the classpath; typo'd member name passed by a hand-written processor; annotation member removed in a refactoring but a caller not updated.","solutions":["Check that the fieldName string exactly matches a member declared in the annotation interface.","Ensure only one version of the annotation class is on the compile classpath (mvn dependency:tree / gradle dependencies to spot duplicates).","Update the processor to the version of the annotation library it processes.","Clean build artifacts so recompiled sources use the current annotation definition."],"exampleFix":"// before\nString name = \"converte\"; // typo: member does not exist\nTypeElement conv = ProcessorUtils.getAnnotationFieldValues(element, name, ...);\n\n// after\nString name = \"converter\"; // matches @interface member exactly","handlingStrategy":"validation","validationCode":"// Verify the member exists on the annotation type before reading it\nboolean memberExists(Elements elements, TypeElement annotation, String fieldName) {\n  for (ExecutableElement e : ElementFilter.methodsIn(annotation.getEnclosedElements())) {\n    if (e.getSimpleName().contentEquals(fieldName)) return true;\n  }\n  return false;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Derive fieldName from a constant shared with the annotation definition instead of string literals.","Run a clean build after changing annotation members so processor and sources stay in sync.","Check dependency trees for duplicate annotation jars."],"tags":["annotation-processing","java","compile-time","reflection"],"backgroundTag":null,"analyzedSha":"e6e199d0601a244511b4cf18c8b2828aa73db1fd","analyzedAt":"2026-08-14T10:24:27.848Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}