{"record":{"id":"4394335dae846234","repo":"quarkusio/quarkus","slug":"cannot-have-more-than-one-of-pathparam-querypar","errorCode":null,"errorMessage":"Cannot have more than one of @PathParam, @QueryParam, @HeaderParam, @FormParam, @CookieParam, @BeanParam, @Context on ","messagePattern":"Cannot have more than one of @PathParam, @QueryParam, @HeaderParam, @FormParam, @CookieParam, @BeanParam, @Context on ","errorType":"validation","errorClass":"DeploymentException","httpStatus":null,"severity":"error","filePath":"independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/EndpointIndexer.java","lineNumber":1303,"sourceCode":"        AnnotationInstance cookieParam = anns.get(COOKIE_PARAM);\n        AnnotationInstance restPathParam = anns.get(REST_PATH_PARAM);\n        AnnotationInstance restQueryParam = anns.get(REST_QUERY_PARAM);\n        AnnotationInstance restHeaderParam = anns.get(REST_HEADER_PARAM);\n        AnnotationInstance restFormParam = anns.get(REST_FORM_PARAM);\n        AnnotationInstance restMatrixParam = anns.get(REST_MATRIX_PARAM);\n        AnnotationInstance restCookieParam = anns.get(REST_COOKIE_PARAM);\n        AnnotationInstance contextParam = anns.get(CONTEXT);\n        AnnotationInstance defaultValueAnnotation = anns.get(DEFAULT_VALUE);\n        AnnotationInstance suspendedAnnotation = anns.get(SUSPENDED);\n        boolean convertible = false;\n        if (defaultValueAnnotation != null) {\n            builder.setDefaultValue(defaultValueAnnotation.value().asString());\n        }\n        if (handleCustomParameter(anns, builder, paramType, field, methodContext)) {\n            return builder;\n        } else if (moreThanOne(pathParam, queryParam, headerParam, formParam, cookieParam, contextParam, beanParam,\n                restPathParam, restQueryParam, restHeaderParam, restFormParam, restCookieParam)) {\n            throw new DeploymentException(\n                    \"Cannot have more than one of @PathParam, @QueryParam, @HeaderParam, @FormParam, @CookieParam, @BeanParam, @Context on \"\n                            + builder.getErrorLocation());\n        } else if (pathParam != null) {\n            builder.setName(pathParam.value().asString());\n            builder.setType(ParameterType.PATH);\n            convertible = true;\n        } else if (restPathParam != null) {\n            builder.setName(parameterNameOrFail(restPathParam.value(), sourceName, \"RestPath\", builder.getErrorLocation()));\n            builder.setType(ParameterType.PATH);\n            convertible = true;\n        } else if (queryParam != null) {\n            builder.setName(queryParam.value().asString());\n            builder.setType(ParameterType.QUERY);\n            builder.setSeparator(getSeparator(anns));\n            convertible = true;\n        } else if (restQueryParam != null) {\n            builder.setName(parameterNameOrFail(restQueryParam.value(), sourceName, \"RestQuery\", builder.getErrorLocation()));\n            builder.setType(ParameterType.QUERY);","sourceCodeStart":1285,"sourceCodeEnd":1321,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/EndpointIndexer.java#L1285-L1321","documentation":"A single parameter (or field of a bean) may carry at most one request-data annotation among @PathParam, @QueryParam, @HeaderParam, @FormParam, @CookieParam, @BeanParam, @Context (and their @Rest* counterparts). Binding one parameter to two sources is ambiguous, so EndpointIndexer fails deployment via the moreThanOne(...) check.","triggerScenarios":"A resource method parameter is annotated with two or more of the binding annotations, e.g. @QueryParam(\"q\") @HeaderParam(\"x\") String v, or a @RestForm that also has @PathParam; also triggered inside @BeanParam field processing.","commonSituations":"Copy-paste adding a second annotation to switch binding source without removing the first; accidental multi-annotation after merge conflicts; annotation-adding IDE quick-fixes stacking binding annotations.","solutions":["Keep exactly one binding annotation per parameter, matching the intended source (path, query, header, form, cookie, or context)","If the value must come from multiple sources, declare separate parameters and combine them in the method body","Check custom handleCustomParameter logic/annotations if the parameter intentionally maps via a framework extension"],"exampleFix":"// before\npublic String get(@QueryParam(\"q\") @HeaderParam(\"x-q\") String value) { ... }\n// after\npublic String get(@QueryParam(\"q\") String query, @HeaderParam(\"x-q\") String header) { ... }","handlingStrategy":"validation","validationCode":"static final Set<Class<?>> BINDING = Set.of(\n    PathParam.class, QueryParam.class, HeaderParam.class,\n    FormParam.class, CookieParam.class, BeanParam.class, Context.class);\nstatic void validateOneBindingPerParam(Method m) {\n    for (java.lang.reflect.Parameter p : m.getParameters()) {\n        long n = java.util.Arrays.stream(p.getAnnotations())\n            .filter(a -> BINDING.contains(a.annotationType())\n                || a.annotationType().getName().startsWith(\"io.quarkus.resteasy.reactive\"))\n            .map(a -> a.annotationType().getSimpleName().replace(\"Rest\", \"\"))\n            .distinct().count();\n        if (n > 1) throw new IllegalStateException(\"Multiple binding annotations on \" + p);\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["One binding annotation per parameter — never stack @QueryParam with @HeaderParam etc.","If multiple sources are needed, use separate parameters and combine in code","Use @BeanParam to aggregate multiple bindings into one object instead of stacking annotations","Add an annotation-scanning unit test over resource classes in CI"],"tags":["quarkus","resteasy-reactive","parameter-binding","annotations","deployment"],"backgroundTag":"conflicting-parameter-annotations","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"}