{"record":{"id":"be3e24aba91eb8a8","repo":"quarkusio/quarkus","slug":"duplicate-annotationname-annotation-for-paramet","errorCode":null,"errorMessage":"Duplicate ${annotationName} annotation for parameter: ${name} on ${target}","messagePattern":"Duplicate (.+?) annotation for parameter: (.+?) on (.+?)","errorType":"exception","errorClass":"RestClientDefinitionException","httpStatus":null,"severity":"error","filePath":"extensions/resteasy-reactive/rest-client/deployment/src/main/java/io/quarkus/rest/client/reactive/deployment/MicroProfileRestClientEnricher.java","lineNumber":361,"sourceCode":"\n        Map<String, ParamData> methodLevelParamsByName = new HashMap<>();\n        AnnotationInstance methodLevelParam = method.annotation(clientParamAnnotation);\n        if (methodLevelParam != null) {\n            methodLevelParamsByName.put(methodLevelParam.value(\"name\").asString(),\n                    new ParamData(methodLevelParam, interfaceClass));\n        }\n        putAllParamAnnotations(methodLevelParamsByName, interfaceClass,\n                extractAnnotations(method.annotation(clientParamsAnnotation)), annotationName);\n\n        paramFillersByName.putAll(methodLevelParamsByName);\n    }\n\n    private void putAllParamAnnotations(Map<String, ParamData> paramMap, ClassInfo interfaceClass,\n            AnnotationInstance[] annotations, String annotationName) {\n        for (AnnotationInstance annotation : annotations) {\n            String name = annotation.value(\"name\").asString();\n            if (paramMap.put(name, new ParamData(annotation, interfaceClass)) != null) {\n                throw new RestClientDefinitionException(\"Duplicate \" + annotationName + \" annotation for parameter: \" + name +\n                        \" on \" + annotation.target());\n            }\n        }\n    }\n\n    private void addParam(MethodInfo declaringMethod, MethodCreator methodCreator,\n            ParamData paramData, BuildProducer<GeneratedClassBuildItem> generatedClasses,\n            IndexView index, DotName clientParamAnnotation, String annotationName, String paramName,\n            Supplier<ResultHandle> existenceChecker,\n            BiConsumer<BytecodeCreator, ResultHandle> paramAdder) {\n\n        AnnotationInstance annotation = paramData.annotation;\n        ClassInfo declaringClass = paramData.definingClass;\n\n        ResultHandle isParamPresent = existenceChecker.get();\n        BytecodeCreator creator = methodCreator.ifTrue(isParamPresent).falseBranch();\n\n        String[] values = annotation.value().asStringArray();","sourceCodeStart":343,"sourceCodeEnd":379,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/resteasy-reactive/rest-client/deployment/src/main/java/io/quarkus/rest/client/reactive/deployment/MicroProfileRestClientEnricher.java#L343-L379","documentation":"MicroProfile REST Client parameter annotations like @QueryParam and @HeaderParam (and @PathParam/@CookieParam variants) are collected per method parameter. Each parameter may carry only one instance of a given annotation kind; putAllParamAnnotations uses the annotation's 'name' as a map key and throws RestClientDefinitionException when a duplicate name would overwrite existing data.","triggerScenarios":"Two annotations of the same type (e.g. two @QueryParam) targeting the same parameter name across the client interface hierarchy, or one annotation processed twice for a parameter with identical 'name' values.","commonSituations":"Copy-paste duplicates in an interface; inheriting annotated methods from a parent interface where a child re-declares the same parameter annotation; IDE auto-completion inserting a second @QueryParam on one parameter.","solutions":["Remove the duplicate annotation for that parameter — one @QueryParam(\"x\") per parameter","If both parent and child interfaces declare it, keep only one declaration or remove the override's duplicate","Audit the interface named in 'on ${target}' for repeated annotation names"],"exampleFix":"// before\nvoid get(@QueryParam(\"q\") String q, @QueryParam(\"q\") String q2); // duplicate 'q'\n// after\nvoid get(@QueryParam(\"q\") String q, @QueryParam(\"q2\") String q2);","handlingStrategy":"validation","validationCode":"Set<String> seen = new HashSet<>();\nfor (Annotation a : param.getAnnotations()) {\n    String name = annotationNameOf(a); // e.g. @QueryParam value/name\n    if (!seen.add(a.annotationType().getName() + \":\" + name)) {\n        throw new IllegalStateException(\"Duplicate \" + a.annotationType() + \" for parameter\");\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    enricher.collectClientParamData(...);\n} catch (RestClientDefinitionException e) {\n    if (e.getMessage().startsWith(\"Duplicate\")) { /* deduplicate annotations */ }\n    throw e;\n}","preventionTips":["One annotation instance per parameter per annotation type","Check parent interfaces for inherited duplicates when overriding methods","Search the interface for repeated @QueryParam/@HeaderParam names before build","Enable IDE duplicate-annotation inspections"],"tags":["rest-client","microprofile","duplicate-annotation","build-time"],"backgroundTag":"duplicate-annotation","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}