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

  1. Pass a real Java array (primitive or Object[]) instead of a List/Collection
  2. Convert collections first: list.toArray(new String[0])
  3. Ensure earlier branches (String, primitives) are matched before reaching boxArray by checking value.getClass().isArray() first
  4. 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

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


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/d4e9d62314a76cd8. Report an issue: GitHub.