{"record":{"id":"5491a0420c49a2e0","repo":"quarkusio/quarkus","slug":"method-of-class-contains-multiple-http-metho","errorCode":null,"errorMessage":"Method '' of class '' contains multiple HTTP method annotations.","messagePattern":"Method '' of class '' contains multiple HTTP method annotations\\.","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":540,"sourceCode":"     * By default, we are not removing the trailing slash.\n     */\n    protected String handleTrailingSlash(String path) {\n        return path;\n    }\n\n    private void validateHttpAnnotations(MethodInfo info) {\n        List<AnnotationInstance> annotationInstances = info.annotations();\n        Set<DotName> allMethodAnnotations = new HashSet<>(annotationInstances.size());\n        for (AnnotationInstance instance : annotationInstances) {\n            allMethodAnnotations.add(instance.name());\n        }\n        int httpAnnotationCount = 0;\n        for (DotName dotName : allMethodAnnotations) {\n            if (httpAnnotationToMethod.containsKey(dotName)) {\n                httpAnnotationCount++;\n            }\n            if (httpAnnotationCount > 1) {\n                throw new DeploymentException(\"Method '\" + info.name() + \"' of class '\" + info.declaringClass().name()\n                        + \"' contains multiple HTTP method annotations.\");\n            }\n        }\n    }\n\n    private static boolean hasProperModifiers(MethodInfo info) {\n        if (isSynthetic(info.flags())) {\n            log.debug(\"Method '\" + info.name() + \" of Resource class '\" + info.declaringClass().name()\n                    + \"' is a synthetic method and will therefore be ignored\");\n            return false;\n        }\n        if ((info.flags() & Modifier.PUBLIC) == 0) {\n            log.warn(\"Method '\" + info.name() + \" of Resource class '\" + info.declaringClass().name()\n                    + \"' is not public and will therefore be ignored\");\n            return false;\n        }\n        if ((info.flags() & Modifier.STATIC) != 0) {\n            log.warn(\"Method '\" + info.name() + \" of Resource class '\" + info.declaringClass().name()","sourceCodeStart":522,"sourceCodeEnd":558,"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#L522-L558","documentation":"EndpointIndexer.validateHttpAnnotations checks that a JAX-RS resource method carries at most one HTTP method annotation (@GET, @POST, @PUT, etc.). If two recognized HTTP method annotations are present on the same method, createEndpoints fails with a DeploymentException naming the method and class. A resource method must map to exactly one HTTP verb.","triggerScenarios":"Annotating one resource method with two HTTP verb annotations, e.g. both @GET and @POST, or a custom @HttpMethod annotation combined with a standard one, discovered while indexing the class.","commonSituations":"Copy-paste of annotations intending 'supports GET or POST'; a custom @HttpMethod meta-annotation whose name clashes with a built-in one; accidental duplicate annotations after merging branches.","solutions":["Remove one of the HTTP method annotations so the method handles a single verb","Split the logic into two methods, one per HTTP verb","If multiple verbs should be handled, implement @OPTIONS/@HttpMethod overloads as separate methods or use a custom annotation only for verbs not built in"],"exampleFix":"// before\n@Path(\"/item\")\n@GET\n@POST\npublic Item getOrCreate() { ... }\n// after\n@GET public Item get() { ... }\n@POST public Item create() { ... }","handlingStrategy":"validation","validationCode":"long httpAnnotations = Arrays.stream(method.getAnnotations())\n    .map(Annotation::annotationType)\n    .filter(t -> t.isAnnotationPresent(HttpMethod.class))\n    .distinct().count();\nif (httpAnnotations > 1) throw new IllegalStateException(\"Multiple HTTP verbs on \" + method);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["One verb annotation per resource method","Split multi-verb handling into separate methods","Review custom @HttpMethod annotations for clashes","Enable Quarkus dev-mode which surfaces this at startup"],"tags":["jaxrs","deployment","annotations","build-time"],"backgroundTag":"multiple-http-method-annotations","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"}