quarkusio/quarkus · error · IllegalArgumentException
Not an array:
Error message
Not an array:
What it means
Annotations.boxArray() boxes primitive array values (boolean[], int[], etc.) so they can be converted into Jandex array AnnotationValues. If the input is neither a primitive array nor an Object[], it throws IllegalArgumentException('Not an array: ...'). It is a defensive check inside annotation value conversion.
Source
Thrown at independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Annotations.java:377
return boxedArray;
} else if (value instanceof double[]) {
double[] primitiveArray = (double[]) value;
Object[] boxedArray = new Double[primitiveArray.length];
for (int i = 0; i < primitiveArray.length; i++) {
boxedArray[i] = primitiveArray[i];
}
return boxedArray;
} else if (value instanceof char[]) {
char[] primitiveArray = (char[]) value;
Object[] boxedArray = new Character[primitiveArray.length];
for (int i = 0; i < primitiveArray.length; i++) {
boxedArray[i] = primitiveArray[i];
}
return boxedArray;
} else if (value instanceof Object[]) {
return (Object[]) value;
} else {
throw new IllegalArgumentException("Not an array: " + value);
}
}
}
View on GitHub (pinned to e1c734241f)
Solutions
- Pass a real Java array (primitive or Object[]) instead of a List/Collection
- Convert collections first: list.toArray(new String[0])
- Ensure earlier branches (String, primitives) are matched before reaching boxArray by checking value.getClass().isArray() first
- Fix the annotation member type so values arrive as arrays
Example fix
// before
jandexValue(name, List.of("a"));
// after
jandexValue(name, List.of("a").toArray(new String[0])); Defensive patterns
Strategy: validation
Validate before calling
if (value == null || !value.getClass().isArray()) throw new IllegalArgumentException("Expected array, got " + (value == null ? "null" : value.getClass())); Type guard
static boolean isArrayValue(Object v) { return v != null && v.getClass().isArray(); } Try / catch
try { Object[] boxed = boxArray(value); }
catch (IllegalArgumentException e) { throw new IllegalArgumentException("Provide a Java array, not " + value.getClass(), e); } Prevention
- Call value.getClass().isArray() before array handling paths
- Use toArray(new T[0]) for collections
- Keep conversion entry points typed so non-arrays can't reach boxArray
When it happens
Trigger: Calling the value-conversion path with a value whose class is not an array at all — e.g. a Collection, a String where an array was expected, or a generic Object that skipped earlier type checks.
Common situations: Programmatic AnnotationInstance construction passing collections instead of arrays; mis-typed members when synthesizing annotations in extensions or tests; reflection maps with wrong value types.
Related errors
- Annotation does not have @Retention(RUNTIME):
- Annotation class not available:
- Value is not set for %s.%s(). Most probably an older version
- Class of nested annotation missing
- Array component kind is
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/d4e9d62314a76cd8.
Report an issue: GitHub.