{"record":{"id":"e4feb066661eb8bb","repo":"quarkusio/quarkus","slug":"no-public-method-annotated-with-path","errorCode":null,"errorMessage":"No public method annotated with @Path ","messagePattern":"No public method annotated with @Path ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/jaxrs/UriBuilderImpl.java","lineNumber":429,"sourceCode":"    }\n\n    public UriBuilder path(Class resource, String method) throws IllegalArgumentException {\n        if (resource == null)\n            throw new IllegalArgumentException(\"resource is null\");\n        if (method == null)\n            throw new IllegalArgumentException(\"method is null\");\n        Method theMethod = null;\n        for (Method m : resource.getMethods()) {\n            if (m.getName().equals(method)) {\n                if (theMethod != null && m.isAnnotationPresent(Path.class)) {\n                    throw new IllegalArgumentException(\"Two methods with the same path \" + method);\n                }\n                if (m.isAnnotationPresent(Path.class))\n                    theMethod = m;\n            }\n        }\n        if (theMethod == null)\n            throw new IllegalArgumentException(\"No public method annotated with @Path \" + resource.getName() + \" \" + method);\n        return path(theMethod);\n    }\n\n    public UriBuilder path(Method method) throws IllegalArgumentException {\n        if (method == null) {\n            throw new IllegalArgumentException(\"method is null\");\n        }\n        Path ann = method.getAnnotation(Path.class);\n        if (ann != null) {\n            path = paths(encode, path, ann.value());\n        } else {\n            throw new IllegalArgumentException(\"Method not annotated with @Path\");\n        }\n        return this;\n    }\n\n    public UriBuilder replaceMatrix(String matrix) throws IllegalArgumentException {\n        if (matrix == null)","sourceCodeStart":411,"sourceCodeEnd":447,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/jaxrs/UriBuilderImpl.java#L411-L447","documentation":"After scanning the resource class's public methods by name, the builder throws this IllegalArgumentException if none of the matching methods is annotated with @Path. path(Class, String) can only build a segment from a @Path value, so a name match without the annotation is treated as 'not found'.","triggerScenarios":"Calling path(Resource.class, \"list\") where either no method named 'list' exists, or a method named 'list' exists but lacks @Path (e.g. it is a helper, a non-endpoint, or the @Path was removed).","commonSituations":"Typo in the method name string; method is private/protected so getMethods() (public only) misses it; @Path annotation dropped during refactoring or replaced with @GET-only routing; method renamed in a version upgrade.","solutions":["Verify the method name string matches a public method exactly (spelling/case).","Add @Path to the intended endpoint method on the resource class.","Make the method public so resource.getMethods() can see it.","Resolve the Method reflectively and call path(Method) after confirming it has @Path."],"exampleFix":"// before\npublic List<Order> listAll() {...} // no @Path\nbuilder.path(OrderResource.class, \"listAll\");\n// after\n@Path(\"/all\")\npublic List<Order> listAll() {...}\nbuilder.path(OrderResource.class, \"listAll\");","handlingStrategy":"validation","validationCode":"Method target = Arrays.stream(OrderResource.class.getMethods())\n    .filter(m -> m.getName().equals(methodName) && m.isAnnotationPresent(Path.class))\n    .findFirst()\n    .orElseThrow(() -> new IllegalArgumentException(\"No public @Path method \" + methodName));","typeGuard":"static Optional<Method> pathMethod(Class<?> c, String name) {\n    return Arrays.stream(c.getMethods())\n        .filter(m -> m.getName().equals(name) && m.isAnnotationPresent(Path.class))\n        .findFirst();\n}","tryCatchPattern":"try {\n    uri = builder.path(OrderResource.class, methodName).build();\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"No public method annotated with @Path\")) {\n        throw new IllegalStateException(\"Check method name/visibility/@Path on \" + OrderResource.class, e);\n    }\n    throw e;\n}","preventionTips":["Verify spelling and case of the method name string","Ensure endpoint methods are public and carry @Path","Add a startup test that resolves every client operation name","Grep for recently renamed/removed @Path methods after upgrades"],"tags":["jaxrs","resteasy-reactive","uribuilder","missing-path-annotation"],"backgroundTag":"missing-path-annotation","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"}