{"record":{"id":"443080cd77e46371","repo":"quarkusio/quarkus","slug":"ambiguous-s-definition-more-than-one-method-of-n","errorCode":null,"errorMessage":"Ambiguous %s definition, more than one method of name %s found on %s. Problematic interface: %s","messagePattern":"Ambiguous (.+?) definition, more than one method of name (.+?) found on (.+?)\\. Problematic interface: (.+?)","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":1073,"sourceCode":"            return valueType;\n        }\n\n        Supplier<ResultHandle> getResultHandleSupplier() {\n            return resultHandleSupplier;\n        }\n\n        HeaderFillerInfo mapResultHandle(Function<Supplier<ResultHandle>, Supplier<ResultHandle>> mapper) {\n            return new HeaderFillerInfo(this.valueType, this.source, mapper.apply(this.resultHandleSupplier));\n        }\n    }\n\n    private MethodInfo findMethod(ClassInfo declaringClass, ClassInfo restInterface, String methodName,\n            String sourceAnnotationName) {\n        MethodInfo result = null;\n        for (MethodInfo method : declaringClass.methods()) {\n            if (method.name().equals(methodName)) {\n                if (result != null) {\n                    throw new RestClientDefinitionException(String.format(\n                            \"Ambiguous %s definition, more than one method of name %s found on %s. Problematic interface: %s\",\n                            sourceAnnotationName, methodName, declaringClass, restInterface));\n                } else {\n                    result = method;\n                }\n            }\n        }\n        return result;\n    }\n\n    private static boolean isString(Type type) {\n        return type.kind() == Type.Kind.CLASS && type.name().toString().equals(String.class.getName());\n    }\n\n    private static boolean isStringArray(Type returnType) {\n        return returnType.kind() == Type.Kind.ARRAY && returnType.asArrayType().constituent().name().equals(STRING);\n    }\n","sourceCodeStart":1055,"sourceCodeEnd":1091,"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#L1055-L1091","documentation":"@ClientHeaderParam (and similar Client*Param annotations) can reference a method by name, e.g. value=\"{computeHeader}\". findMethod scans the declaring class for methods with that name; if two or more overloads exist, Quarkus cannot decide which one to call and fails the build with RestClientDefinitionException.","triggerScenarios":"ClientHeaderParam value references a method name that is overloaded in the interface or referenced class, e.g. computeHeader() and computeHeader(String) both present.","commonSituations":"Overloading header-provider methods with and without a header-name parameter, or inheriting overloads from multiple implemented interfaces.","solutions":["Rename one of the overloads so the referenced name is unique","Remove the unused overload","Keep exactly one method with the referenced name that returns String or String[]"],"exampleFix":"// before\nString computeHeader() { ... }\nString computeHeader(String name) { ... }\n\n// after\nString computeHeader() { ... }\nString computeHeaderForName(String name) { ... }","handlingStrategy":"validation","validationCode":"long count = Arrays.stream(MyClient.class.getDeclaredMethods())\n    .filter(m -> m.getName().equals(\"computeHeader\"))\n    .count();\nif (count > 1) {\n    throw new IllegalStateException(\"Method referenced by ClientHeaderParam must not be overloaded\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never overload methods referenced by name in Client*Param annotations","Use distinct, descriptive names for header-provider methods","Check inherited/default interface methods for name collisions"],"tags":["quarkus","rest-client","build-time","ambiguous-method","overloading"],"backgroundTag":"ambiguous-method-overload","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"}