{"record":{"id":"69f614daa74af121","repo":"quarkusio/quarkus","slug":"attempt-to-pass-at-least-two-of-form-or-regular-en","errorCode":null,"errorMessage":"Attempt to pass at least two of form or regular entity as a request body in {restClientInterface}#{jandexMethod.name}","messagePattern":"Attempt to pass at least two of form or regular entity as a request body in (.+?)#(.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/resteasy-reactive/rest-client-jaxrs/deployment/src/main/java/io/quarkus/jaxrs/client/reactive/deployment/JaxrsClientReactiveProcessor.java","lineNumber":2710,"sourceCode":"        if (!exceptions.contains(Exception.class.getName()) && !exceptions.contains(Throwable.class.getName())) {\n            exceptions.add(RuntimeException.class.getName());\n        }\n\n        CatchBlockCreator catchBlock = tryBlock.addCatch(ProcessingException.class);\n        ResultHandle caughtException = catchBlock.getCaughtException();\n        ResultHandle cause = catchBlock.invokeVirtualMethod(\n                MethodDescriptor.ofMethod(Throwable.class, \"getCause\", Throwable.class),\n                caughtException);\n        for (String exception : exceptions) {\n            catchBlock.ifTrue(catchBlock.instanceOf(cause, exception))\n                    .trueBranch().throwException(cause);\n        }\n\n        catchBlock.throwException(caughtException);\n\n        if (bodyValue != null || formParams != null) {\n            if (countNonNulls(bodyValue, formParams) > 1) {\n                throw new IllegalArgumentException(\"Attempt to pass at least two of form \" +\n                        \"or regular entity as a request body in \" +\n                        restClientInterface.name().toString() + \"#\" + jandexMethod.name());\n            }\n\n            if (consumes != null && consumes.length > 0) {\n\n                if (consumes.length > 1) {\n                    Set<String> uniqueConsumes = new TreeSet<>(Arrays.asList(consumes));\n                    mediaTypeValue = uniqueConsumes.iterator().next();\n                    if (uniqueConsumes.size() > 1) {\n                        log.debugf(\"MicroProfile Rest Client `%s`'s method `%s` has multiple `@Consumes` values `%s`,\"\n                                + \" Content-Type will be set to `%s`.\"\n                                + \" You can change Content-Type in a custom jakarta.ws.rs.ClientRequestFilter implementation.\",\n                                restClientInterface.name().toString(), jandexMethod.name(),\n                                uniqueConsumes.stream().collect(Collectors.joining(\", \")),\n                                mediaTypeValue);\n                    }\n                } else {","sourceCodeStart":2692,"sourceCodeEnd":2728,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/resteasy-reactive/rest-client-jaxrs/deployment/src/main/java/io/quarkus/jaxrs/client/reactive/deployment/JaxrsClientReactiveProcessor.java#L2692-L2728","documentation":"A REST client method may carry at most one request body. Quarkus detected both a regular entity/body value and form parameters (or two body-ish sources) on the same method, which is ambiguous when building the HTTP request, so generation fails.","triggerScenarios":"A client method with a @Body-style entity parameter plus @FormParam parameters, or a @MultipartForm combined with an entity argument, on a single interface method.","commonSituations":"Trying to POST a JSON body along with form fields in one call; mixing @MultipartForm with a payload argument after a refactor.","solutions":["Remove one of the two bodies — either send the entity OR the form params, not both","Move form fields into the entity DTO and send a single object","Split into two endpoints/methods: one for the entity, one for the form-encoded request"],"exampleFix":"// before\n@POST\n@Path(\"submit\")\nvoid submit(MyEntity e, @FormParam(\"tag\") String tag);\n// after\n@POST\n@Path(\"submit\")\nvoid submit(SubmitRequest request); // request contains entity fields + tag","handlingStrategy":"validation","validationCode":"static void validateSingleBody(Class<?> client) {\n    for (var m : client.getDeclaredMethods()) {\n        int bodyish = 0;\n        for (var p : m.getParameters()) {\n            if (p.isAnnotationPresent(jakarta.ws.rs.FormParam.class)\n                || p.isAnnotationPresent(org.jboss.resteasy.reactive.PartType.class)\n                || p.isAnnotationPresent(org.jboss.resteasy.reactive.RestForm.class)) bodyish++;\n        }\n        for (var p : m.getParameters()) {\n            boolean annotated = p.getAnnotations().length > 0 && java.util.Arrays.stream(p.getAnnotations())\n                .anyMatch(a -> a.annotationType().getName().startsWith(\"jakarta.ws.rs.\"));\n            if (!annotated) bodyish++; // unannotated param = entity body\n        }\n        if (bodyish > 1) throw new IllegalStateException(\n            client.getName() + \"#\" + m.getName() + \" mixes entity body and form params\");\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["One body per method: either an entity or form params, never both","Fold form fields into a request DTO when both kinds of data are needed","Review client interfaces in code review for mixed @FormParam + entity signatures"],"tags":["quarkus","rest-client","request-body","form-params"],"backgroundTag":"ambiguous-request-body","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"}