{"record":{"id":"3266276fd1b2ecf4","repo":"quarkusio/quarkus","slug":"ambiguous-httpmethod-definition-on-type-typedef","errorCode":null,"errorMessage":"Ambiguous @HttpMethod definition on type ${typeDef}","messagePattern":"Ambiguous @HttpMethod definition on type (.+?)","errorType":"validation","errorClass":"RestClientDefinitionException","httpStatus":null,"severity":"error","filePath":"extensions/resteasy-classic/resteasy-client/runtime/src/main/java/io/quarkus/restclient/runtime/QuarkusRestClientBuilder.java","lineNumber":590,"sourceCode":"                paramMap.put(name, \"foobar\");\n            }\n\n        }\n    }\n\n    private <T> void verifyInterface(Class<T> typeDef) {\n\n        Method[] methods = resolveMethods(typeDef);\n\n        // multiple verbs\n        for (Method method : methods) {\n            boolean hasHttpMethod = false;\n            for (Annotation annotation : method.getAnnotations()) {\n                boolean isHttpMethod = (annotation.annotationType().getAnnotation(HttpMethod.class) != null);\n                if (!hasHttpMethod && isHttpMethod) {\n                    hasHttpMethod = true;\n                } else if (hasHttpMethod && isHttpMethod) {\n                    throw new RestClientDefinitionException(\"Ambiguous @HttpMethod definition on type \" + typeDef);\n                }\n            }\n        }\n\n        // invalid parameter\n        Path classPathAnno = typeDef.getAnnotation(Path.class);\n\n        ResteasyUriBuilder template = null;\n        for (Method method : methods) {\n            Path methodPathAnno = method.getAnnotation(Path.class);\n            if (methodPathAnno != null) {\n                template = classPathAnno == null\n                        ? (ResteasyUriBuilder) new ResteasyUriBuilderImpl().path(methodPathAnno.value())\n                        : (ResteasyUriBuilder) new ResteasyUriBuilderImpl()\n                                .path(classPathAnno.value() + \"/\" + methodPathAnno.value());\n            } else if (classPathAnno != null) {\n                template = (ResteasyUriBuilder) new ResteasyUriBuilderImpl().path(classPathAnno.value());\n            } else {","sourceCodeStart":572,"sourceCodeEnd":608,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/resteasy-classic/resteasy-client/runtime/src/main/java/io/quarkus/restclient/runtime/QuarkusRestClientBuilder.java#L572-L608","documentation":"Thrown by QuarkusRestClientBuilder.verifyInterface (during build) as a RestClientDefinitionException when a resource interface method carries more than one HTTP method annotation (@GET, @POST, @PUT, @DELETE, etc.). Each interface method must declare exactly one HTTP verb.","triggerScenarios":"Annotating one client interface method with two HTTP annotations (e.g. @GET and @POST); meta-annotations that accidentally both carry @HttpMethod; copy-paste leaving an old verb annotation in place.","commonSituations":"Refactoring @GET to @POST and keeping both; combining custom verb annotations with standard ones on the same method; IDE auto-import adding a second annotation.","solutions":["Keep exactly one HTTP method annotation per interface method — remove the extra one","If a custom verb is needed, ensure it doesn't stack with a standard annotation","Verify with the MicroProfile spec: one @HttpMethod meta-annotated annotation per resource method"],"exampleFix":"// before\n@GET\n@POST\n@Path(\"/items\")\nList<Item> getItems();\n// after\n@GET\n@Path(\"/items\")\nList<Item> getItems();","handlingStrategy":"validation","validationCode":"for (Method m : MyClient.class.getMethods()) {\n    long count = Arrays.stream(m.getAnnotations())\n        .filter(a -> a.annotationType().isAnnotationPresent(HttpMethod.class))\n        .count();\n    if (count > 1) throw new IllegalStateException(m + \" has multiple HTTP method annotations\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    client = builder.build(MyClient.class);\n} catch (RestClientDefinitionException e) {\n    if (e.getMessage().startsWith(\"Ambiguous @HttpMethod definition\")) {\n        log.error(\"Interface method has two HTTP verb annotations: {}\", e.getMessage());\n    }\n    throw e;\n}","preventionTips":["Exactly one HTTP verb annotation per interface method","After refactoring verbs, delete the old annotation, don't stack","Code-review client interfaces for duplicate annotations","Catch this with an early unit test that builds the client"],"tags":["rest-client","interface-validation","http-method","rest-client-definition-exception"],"backgroundTag":"ambiguous-http-method","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}