{"record":{"id":"a21bd3bede099ec5","repo":"quarkusio/quarkus","slug":"endpoint-uri-not-set","errorCode":null,"errorMessage":"Endpoint URI not set!","messagePattern":"Endpoint URI not set!","errorType":"exception","errorClass":"WebSocketClientException","httpStatus":null,"severity":"error","filePath":"extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/runtime/BasicWebSocketConnectorImpl.java","lineNumber":126,"sourceCode":"        return self();\n    }\n\n    @Override\n    public BasicWebSocketConnector onClose(BiConsumer<WebSocketClientConnection, CloseReason> consumer) {\n        this.closeHandler = Objects.requireNonNull(consumer);\n        return self();\n    }\n\n    @Override\n    public BasicWebSocketConnector onError(BiConsumer<WebSocketClientConnection, Throwable> consumer) {\n        this.errorHandler = Objects.requireNonNull(consumer);\n        return self();\n    }\n\n    @Override\n    public Uni<WebSocketClientConnection> connect() {\n        if (baseUri == null) {\n            throw new WebSocketClientException(\"Endpoint URI not set!\");\n        }\n\n        // A new client is created for each connection\n        // The client is created when the returned Uni is subscribed\n        // The client is closed when the connection is closed\n        AtomicReference<WebSocketClient> client = new AtomicReference<>();\n\n        WebSocketConnectOptions connectOptions = newConnectOptions(baseUri);\n        StringBuilder requestUri = new StringBuilder();\n        String mergedPath = mergePath(baseUri.getPath(), replacePathParameters(path));\n        requestUri.append(mergedPath);\n        if (baseUri.getQuery() != null) {\n            requestUri.append(\"?\").append(baseUri.getQuery());\n        }\n        connectOptions.setURI(requestUri.toString());\n        for (Entry<String, List<String>> e : headers.entrySet()) {\n            for (String val : e.getValue()) {\n                connectOptions.addHeader(e.getKey(), val);","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/runtime/BasicWebSocketConnectorImpl.java#L108-L144","documentation":"BasicWebSocketConnectorImpl.connect() requires an endpoint URI configured beforehand via the connector's baseUri builder methods. Calling connect() without ever setting the URI throws WebSocketClientException 'Endpoint URI not set!'.","triggerScenarios":"Instantiating BasicWebSocketConnector (e.g. via BasicWebSocketConnector.create()) and calling connect() without calling .baseUri(...) first, or after a builder path that reset the URI.","commonSituations":"Building the connector programmatically and forgetting the baseUri step; deriving the URI from config that resolved to null; refactoring the fluent chain and dropping the baseUri call.","solutions":["Call .baseUri(String) on the connector before connect()","Make the URI come from application config and assert it is non-null before creating the connector","Prefer WebSocketClient client injection with @WebSocketClient endpoint, which resolves the URI automatically"],"exampleFix":"// before\nBasicWebSocketConnector.create().connect().await().indefinitely();\n// after\nBasicWebSocketConnector.create()\n    .baseUri(\"ws://localhost:8080/ws\")\n    .connect().await().indefinitely();","handlingStrategy":"validation","validationCode":"var connector = BasicWebSocketConnector.create();\nObjects.requireNonNull(endpointUri, \"Endpoint URI must be set before connect()\");\nconnector.baseUri(endpointUri).connect();","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always call baseUri(...) immediately after BasicWebSocketConnector.create()","Back the URI with config and fail fast at startup if it is missing","Prefer @WebSocketClient injection which wires the URI automatically"],"tags":["websockets","client","configuration"],"backgroundTag":"missing-required-config","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"}