{"record":{"id":"17d76e10f419ebaf","repo":"quarkusio/quarkus","slug":"unable-to-obtain-the-path-param-for","errorCode":null,"errorMessage":"Unable to obtain the path param for: ","messagePattern":"Unable to obtain the path param for: ","errorType":"exception","errorClass":"WebSocketClientException","httpStatus":null,"severity":"error","filePath":"extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/runtime/WebSocketConnectorBase.java","lineNumber":175,"sourceCode":"            String paramName = match.substring(1, match.length() - 1);\n            names.add(paramName);\n        }\n        return names;\n    }\n\n    String replacePathParameters(String path) {\n        if (path.isEmpty()) {\n            return path;\n        }\n        StringBuilder sb = new StringBuilder();\n        Matcher m = PATH_PARAM_PATTERN.matcher(path);\n        while (m.find()) {\n            // Replace {foo} with the param value\n            String match = m.group();\n            String paramName = match.substring(1, match.length() - 1);\n            String val = pathParams.get(paramName);\n            if (val == null) {\n                throw new WebSocketClientException(\"Unable to obtain the path param for: \" + paramName);\n            }\n            m.appendReplacement(sb, URLEncoder.encode(val, StandardCharsets.UTF_8));\n        }\n        m.appendTail(sb);\n        return path.startsWith(\"/\") ? sb.toString() : \"/\" + sb.toString();\n    }\n\n    protected WebSocketClientOptions populateClientOptions() {\n        final WebSocketClientOptions clientOptions;\n        if (customWebSocketClientOptions != null) {\n            clientOptions = new WebSocketClientOptions(customWebSocketClientOptions);\n        } else {\n            clientOptions = new WebSocketClientOptions();\n        }\n        if (config.offerPerMessageCompression()) {\n            clientOptions.setTryUsePerMessageCompression(true);\n            if (config.compressionLevel().isPresent()) {\n                clientOptions.setCompressionLevel(config.compressionLevel().getAsInt());","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/runtime/WebSocketConnectorBase.java#L157-L193","documentation":"During connect, WebSocketConnectorBase.replacePathParameters() substitutes each {param} placeholder in the client endpoint path with values previously supplied via pathParam(). If a placeholder has no corresponding value in the pathParams map (value == null), this WebSocketClientException is thrown naming the missing parameter.","triggerScenarios":"Connecting while the endpoint path contains a {placeholder} for which pathParam() was never called — e.g. forgetting a required param, building the path dynamically, or the annotation path was changed to add a new placeholder.","commonSituations":"Adding a new placeholder to the @WebSocketClient path without adding a matching pathParam() call in the connector; conditional logic that skips setting a param; config-driven paths.","solutions":["Call pathParam(name, value) for every placeholder in the endpoint path before connect()","Compare the @WebSocketClient path placeholders against the pathParam() calls","Set a default via pathParam() when the value may legitimately be absent"],"exampleFix":"// before\n@WebSocketClient(path = \"/chat/{roomId}\")\nconnector.connect(); // missing roomId\n// after\nconnector.pathParam(\"roomId\", \"42\").connect();","handlingStrategy":"validation","validationCode":"java.util.regex.Matcher m = java.util.regex.Pattern.compile(\"\\\\{([^}]+)}\").matcher(endpointPath);\njava.util.Set<String> required = new java.util.HashSet<>();\nwhile (m.find()) required.add(m.group(1));\n// ensure every required name was supplied via pathParam()","typeGuard":null,"tryCatchPattern":"try {\n    connector.connect();\n} catch (WebSocketClientException e) {\n    log.error(\"Missing path param; supply it with pathParam() before connect()\", e);\n}","preventionTips":["Provide all path params in one place before calling connect()","Add a test that connects with fully parameterized paths","Fail fast at startup by validating declared vs supplied params","Avoid dynamically altering the endpoint path"],"tags":["websockets","path-params","client","missing-value"],"backgroundTag":"missing-path-parameter","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"}