quarkusio/quarkus · error · IllegalArgumentException

BeanParam annotation used on a field that is not an object:

Error message

BeanParam annotation used on a field that is not an object: " + beanParamClass.name() + "." + fieldInfo.name()

What it means

Build-time error from BeanParamParser: an @BeanParam annotation was placed on a field whose type is not an object type (a primitive or similar), so the parser cannot recursively extract nested parameters from it. The declaring class and field name are appended to the message.

Source

Thrown at independent-projects/resteasy-reactive/client/processor/src/main/java/org/jboss/resteasy/reactive/client/processor/beanparam/BeanParamParser.java:120

                            new FieldExtractor(null, fieldInfo.name(), fieldInfo.declaringClass().name().toString()),
                            fieldInfo.type()),
                    (annotationValue, getterMethod) -> new MatrixParamItem(getterMethod.name(),
                            annotationValue != null ? annotationValue : getterName(getterMethod),
                            getterMethod.hasDeclaredAnnotation(ENCODED),
                            new GetterExtractor(getterMethod),
                            getterMethod.returnType())));

            resultList.addAll(paramItemsForFieldsAndMethods(beanParamClass, BEAN_PARAM,
                    (annotationValue, fieldInfo) -> {
                        Type type = fieldInfo.type();
                        if (type.kind() == Type.Kind.CLASS) {
                            DotName beanParamClassName = type.asClassType().name();
                            List<Item> subBeanParamItems = parseInternal(index.getClassByName(beanParamClassName), index,
                                    processedBeanParamClasses);
                            return new BeanParamItem(fieldInfo.name(), subBeanParamItems, beanParamClassName.toString(),
                                    new FieldExtractor(null, fieldInfo.name(), fieldInfo.declaringClass().name().toString()));
                        } else {
                            throw new IllegalArgumentException("BeanParam annotation used on a field that is not an object: "
                                    + beanParamClass.name() + "." + fieldInfo.name());
                        }
                    },
                    (annotationValue, getterMethod) -> {
                        Type returnType = getterMethod.returnType();
                        List<Item> items = parseInternal(index.getClassByName(returnType.name()), index,
                                processedBeanParamClasses);
                        return new BeanParamItem(getterMethod.name(), items, beanParamClass.name().toString(),
                                new GetterExtractor(getterMethod));
                    }));

            resultList.addAll(paramItemsForFieldsAndMethods(beanParamClass, COOKIE_PARAM,
                    (annotationValue, fieldInfo) -> new CookieParamItem(fieldInfo.name(), annotationValue,
                            new FieldExtractor(null, fieldInfo.name(),
                                    fieldInfo.declaringClass().name().toString()),
                            fieldInfo.type().name().toString()),
                    (annotationValue, getterMethod) -> new CookieParamItem(getterMethod.name(), annotationValue,
                            new GetterExtractor(getterMethod), getterMethod.returnType().name().toString())));

View on GitHub (pinned to e1c734241f)

Solutions

  1. Give the bean param field a complex/object type that can hold nested REST annotations
  2. Move the REST parameter annotations (@QueryParam, @HeaderParam, ...) directly onto a supported field
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at independent-projects/resteasy-reactive/client/processor/src/main/java/org/jboss/resteasy/reactive/client/processor/beanparam/BeanParamParser.java:120 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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