{"record":{"id":"6dcbdfce6db88088","repo":"quarkusio/quarkus","slug":"multiple-endpoints-s-s-define-the-same-path","errorCode":null,"errorMessage":"Multiple endpoints [%s, %s] define the same path: %s","messagePattern":"Multiple endpoints \\[(.+?), (.+?)\\] define the same path: (.+?)","errorType":"validation","errorClass":"WebSocketServerException","httpStatus":null,"severity":"error","filePath":"extensions/websockets-next/deployment/src/main/java/io/quarkus/websockets/next/deployment/WebSocketProcessor.java","lineNumber":361,"sourceCode":"            } else if (webSocketAnnotation != null && webSocketClientAnnotation != null) {\n                throw new WebSocketException(\n                        \"Endpoint class may not be annotated with both @WebSocket and @WebSocketClient: \" + beanClass);\n            }\n            String path;\n            String id;\n            AnnotationValue inboundProcessingMode;\n            Target target;\n\n            if (webSocketAnnotation != null) {\n                target = Target.SERVER;\n                path = getPath(webSocketAnnotation.value(\"path\").asString());\n                if (beanClass.nestingType() == NestingType.INNER) {\n                    // Sub-websocket - merge the path from the enclosing classes\n                    path = mergePath(getPathPrefix(index, beanClass.enclosingClass()), path);\n                }\n                DotName prevPath = serverPathToEndpoint.put(path, beanClass.name());\n                if (prevPath != null) {\n                    throw new WebSocketServerException(\n                            String.format(\"Multiple endpoints [%s, %s] define the same path: %s\", prevPath, beanClass, path));\n                }\n                AnnotationValue endpointIdValue = webSocketAnnotation.value(\"endpointId\");\n                if (endpointIdValue == null) {\n                    id = beanClass.name().toString();\n                } else {\n                    id = endpointIdValue.asString();\n                }\n                DotName prevId = serverIdToEndpoint.put(id, beanClass.name());\n                if (prevId != null) {\n                    throw new WebSocketServerException(\n                            String.format(\"Multiple endpoints [%s, %s] define the same endpoint id: %s\", prevId, beanClass,\n                                    id));\n                }\n                inboundProcessingMode = webSocketAnnotation.value(\"inboundProcessingMode\");\n            } else {\n                target = Target.CLIENT;\n                path = getPath(webSocketClientAnnotation.value(\"path\").asString());","sourceCodeStart":343,"sourceCodeEnd":379,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/websockets-next/deployment/src/main/java/io/quarkus/websockets/next/deployment/WebSocketProcessor.java#L343-L379","documentation":"Quarkus websockets-next maps server endpoint paths to endpoint classes in a build-time registry; two @WebSocket endpoints resolving to the same path (after prefix merging for nested classes) make routing ambiguous, so WebSocketServerException is thrown.","triggerScenarios":"Two @WebSocket classes with identical path values, or a nested (inner) endpoint whose merged path with its enclosing class prefix collides with another endpoint's path.","commonSituations":"Copy-pasting an endpoint and forgetting to change the path; two nested websockets that merge to the same prefix + path; dynamic path expressions evaluating to the same literal.","solutions":["Change one endpoint's @WebSocket path so paths are unique","Adjust the path prefix of the enclosing class for nested endpoints","Use distinct path variables/segments to differentiate the endpoints"],"exampleFix":"// before\n@WebSocket(path = \"/ws/echo\") class A {}\n@WebSocket(path = \"/ws/echo\") class B {}\n// after\n@WebSocket(path = \"/ws/echo\") class A {}\n@WebSocket(path = \"/ws/echo2\") class B {}","handlingStrategy":"validation","validationCode":"// Unit test guarding path uniqueness across endpoints\n@Test\nvoid serverPathsUnique() {\n  var paths = new HashSet<String>();\n  for (Class<?> c : List.of(EchoSocket.class, ChatSocket.class)) {\n    String p = c.getAnnotation(WebSocket.class).path();\n    if (!paths.add(p)) throw new AssertionError(\"Duplicate server path: \" + p);\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep an inventory of endpoint paths; add a test asserting uniqueness","Remember nested endpoints inherit the enclosing class's path prefix","Use distinct prefixes per feature module"],"tags":["websocket","build-time","duplicate-path","routing"],"backgroundTag":"duplicate-route-path","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"}