{"record":{"id":"65ce66bf0ffd7616","repo":"quarkusio/quarkus","slug":"unknown-annotation-attribute-value","errorCode":null,"errorMessage":"Unknown annotation attribute value: ","messagePattern":"Unknown annotation attribute value: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Annotations.java","lineNumber":313,"sourceCode":"            return org.jboss.jandex.AnnotationValue.createEnumValue(name,\n                    DotName.createSimple(((Enum<?>) value).getDeclaringClass().getName()), ((Enum<?>) value).name());\n        } else if (value instanceof Class) {\n            return org.jboss.jandex.AnnotationValue.createClassValue(name, Types.jandexType((Class<?>) value));\n        } else if (value.getClass().isAnnotation()) {\n            Class<? extends Annotation> annotationType = annotationType((Annotation) value);\n            @SuppressWarnings(\"unchecked\")\n            org.jboss.jandex.AnnotationValue[] jandexAnnotationValues = jandexAnnotationValues(\n                    (Class<Annotation>) annotationType, (Annotation) value);\n            org.jboss.jandex.AnnotationInstance jandexAnnotation = org.jboss.jandex.AnnotationInstance.create(\n                    DotName.createSimple(annotationType.getName()), null, jandexAnnotationValues);\n            return org.jboss.jandex.AnnotationValue.createNestedAnnotationValue(name, jandexAnnotation);\n        } else if (value.getClass().isArray()) {\n            org.jboss.jandex.AnnotationValue[] jandexAnnotationValues = Arrays.stream(boxArray(value))\n                    .map(it -> jandexAnnotationValue(name, it))\n                    .toArray(org.jboss.jandex.AnnotationValue[]::new);\n            return org.jboss.jandex.AnnotationValue.createArrayValue(name, jandexAnnotationValues);\n        } else {\n            throw new IllegalArgumentException(\"Unknown annotation attribute value: \" + value);\n        }\n    }\n\n    private static Object[] boxArray(Object value) {\n        if (value instanceof boolean[]) {\n            boolean[] primitiveArray = (boolean[]) value;\n            Object[] boxedArray = new Boolean[primitiveArray.length];\n            for (int i = 0; i < primitiveArray.length; i++) {\n                boxedArray[i] = primitiveArray[i];\n            }\n            return boxedArray;\n        } else if (value instanceof byte[]) {\n            byte[] primitiveArray = (byte[]) value;\n            Object[] boxedArray = new Byte[primitiveArray.length];\n            for (int i = 0; i < primitiveArray.length; i++) {\n                boxedArray[i] = primitiveArray[i];\n            }\n            return boxedArray;","sourceCodeStart":295,"sourceCodeEnd":331,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Annotations.java#L295-L331","documentation":"Annotations.jandexAnnotationValue() converts a runtime annotation member value into a Jandex AnnotationValue. It handles primitives, String, Class, enum, nested annotations and arrays; any other Java type (arbitrary object) is rejected with IllegalArgumentException. Jandex annotation values must map to one of the metaspace-supported value kinds.","triggerScenarios":"Building a synthetic AnnotationInstance (e.g. via Annotations.create/Jandex value conversion) whose member value is an unsupported object type — e.g. a List, Map, or custom POJO passed as an annotation attribute value.","commonSituations":"Extensions/tests constructing AnnotationInstance programmatically with wrong member values; reflection-extracted annotation maps containing unexpected types; version drift where a new value kind isn't handled.","solutions":["Convert the value to a supported type: primitive, String, Class, enum constant, nested annotation, or flat array of these","For arrays, pass a proper Java array (not a List) of a supported component type","If building AnnotationInstance directly, use org.jboss.jandex.AnnotationValue.create* methods with matching kinds","Check the source annotation definition for a member typed outside CDI-allowed types"],"exampleFix":"// before\nvalues.put(\"tags\", List.of(\"a\",\"b\")); // List unsupported\n// after\nvalues.put(\"tags\", new String[]{\"a\",\"b\"});","handlingStrategy":"validation","validationCode":"static void checkValue(Object v) {\n    boolean ok = v instanceof String || v instanceof Class || v instanceof Enum\n        || v instanceof Annotation || v.getClass().isArray() || v instanceof Number || v instanceof Boolean || v instanceof Character;\n    if (!ok) throw new IllegalArgumentException(\"Unsupported: \" + v.getClass());\n}","typeGuard":"static boolean isJandexSafe(Object v) {\n    return v == null || v instanceof String || v instanceof Class || v instanceof Enum\n        || v instanceof Annotation || v.getClass().isArray();\n}","tryCatchPattern":"try { AnnotationValue av = jandexAnnotationValue(name, val); }\ncatch (IllegalArgumentException e) { throw new IllegalArgumentException(\"Member '\" + name + \"' needs a Jandex-supported value\", e); }","preventionTips":["Never pass Collections/Maps/POJOs as annotation attribute values","Convert Lists to typed arrays before conversion","Use AnnotationValue.create* directly when synthesizing instances"],"tags":["cdi","arc","jandex","annotation-processing"],"backgroundTag":"unsupported-annotation-member-type","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}