quarkusio/quarkus · error · IllegalArgumentException

Unknown primitive type:

Error message

Unknown primitive type: 

What it means

AsmUtil.unboxIfRequired generates bytecode that unboxes a Jandex-typed value when the target is a primitive. Its private unbox switch covers Integer/Long/Short and a default branch that throws IllegalArgumentException 'Unknown primitive type: <jandexType>' when the primitive kind is not among the handled ones in this code path. It is a code-generation-time error, meaning the processor encountered a primitive Type.Kind it cannot emit unboxing instructions for.

Source

Thrown at independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/AsmUtil.java:61

                    unbox(mv, "java/lang/Character", "charValue", "C");
                    break;
                case DOUBLE:
                    unbox(mv, "java/lang/Double", "doubleValue", "D");
                    break;
                case FLOAT:
                    unbox(mv, "java/lang/Float", "floatValue", "F");
                    break;
                case INT:
                    unbox(mv, "java/lang/Integer", "intValue", "I");
                    break;
                case LONG:
                    unbox(mv, "java/lang/Long", "longValue", "J");
                    break;
                case SHORT:
                    unbox(mv, "java/lang/Short", "shortValue", "S");
                    break;
                default:
                    throw new IllegalArgumentException("Unknown primitive type: " + jandexType);
            }
        }
    }

    /**
     * Calls the right unboxing method for the given Jandex Type if it is a primitive.
     *
     * @param mv The MethodVisitor on which to visit the unboxing instructions
     * @param type The Jandex Type to unbox if it is a primitive.
     */
    public static void unboxIfRequired(MethodVisitor mv, org.objectweb.asm.Type type) {
        if (type.getSort() <= org.objectweb.asm.Type.DOUBLE) {
            switch (type.getSort()) {
                case org.objectweb.asm.Type.BOOLEAN:
                    unbox(mv, "java/lang/Boolean", "booleanValue", "Z");
                    break;
                case org.objectweb.asm.Type.BYTE:
                    unbox(mv, "java/lang/Byte", "byteValue", "B");

View on GitHub (pinned to e1c734241f)

Solutions

  1. Change the endpoint/proxy method signature to use a wrapper type (java.lang.Byte, Character, Double, etc.) instead of the offending primitive
  2. Check the RESTEasy Reactive version; upgrade to a release where AsmUtil handles all primitive kinds
  3. Report the failing type (from the message) as a bug with a reproducer if the primitive should be supported

Example fix

// before
public double compute(double input) { ... }
// after (if generator cannot handle it)
public Double compute(Double input) { ... }
Defensive patterns

Strategy: validation

Validate before calling

// check endpoint signatures at build/dev time
// avoid exotic primitives in resource method parameters/returns
boolean usesUnsupportedPrimitive(Method m) {
    return Stream.concat(Stream.of(m.getReturnType()), Arrays.stream(m.getParameterTypes()))
        .anyMatch(t -> t.isPrimitive() && (t == byte.class || t == char.class));
}

Prevention

When it happens

Trigger: Build-time bytecode generation where unboxIfRequired is called with a Jandex Type whose kind is primitive but falls into the default switch branch (e.g. BYTE, CHAR, DOUBLE, FLOAT, BOOLEAN reaching this particular switch, which only explicitly boxes LONG and SHORT among others in the shown region).

Common situations: REST resource or client proxy method signatures with unusual primitive parameter types during Quarkus/RESTEasy Reactive augmentation; upgrading RESTEasy Reactive and hitting an unhandled kind in generated proxies.

Related errors


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