{"record":{"id":"57071ad8ce34b245","repo":"TooTallNate/Java-WebSocket","slug":"unknown-scheme","errorCode":null,"errorMessage":"unknown scheme: ","messagePattern":"unknown scheme: ","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/main/java/org/java_websocket/client/WebSocketClient.java","lineNumber":626,"sourceCode":"    // If you run into problem on Android (NoSuchMethodException), check out the wiki https://github.com/TooTallNate/Java-WebSocket/wiki/No-such-method-error-setEndpointIdentificationAlgorithm\n    // Perform hostname validation\n    sslParameters.setEndpointIdentificationAlgorithm(\"HTTPS\");\n  }\n\n  /**\n   * Extract the specified port\n   *\n   * @return the specified port or the default port for the specific scheme\n   */\n  private int getPort() {\n    int port = uri.getPort();\n    String scheme = uri.getScheme();\n    if (\"wss\".equals(scheme)) {\n      return port == -1 ? WebSocketImpl.DEFAULT_WSS_PORT : port;\n    } else if (\"ws\".equals(scheme)) {\n      return port == -1 ? WebSocketImpl.DEFAULT_PORT : port;\n    } else {\n      throw new IllegalArgumentException(\"unknown scheme: \" + scheme);\n    }\n  }\n\n  /**\n   * Create and send the handshake to the other endpoint\n   *\n   * @throws InvalidHandshakeException a invalid handshake was created\n   */\n  private void sendHandshake() throws InvalidHandshakeException {\n    String path;\n    String part1 = uri.getRawPath();\n    String part2 = uri.getRawQuery();\n    if (part1 == null || part1.length() == 0) {\n      path = \"/\";\n    } else {\n      path = part1;\n    }\n    if (part2 != null) {","sourceCodeStart":608,"sourceCodeEnd":644,"githubUrl":"https://github.com/TooTallNate/Java-WebSocket/blob/afeacbf8c0f6f6a761c9d9daed8c813dd3b8ed7d/src/main/java/org/java_websocket/client/WebSocketClient.java#L608-L644","documentation":"getPort() resolves the connection port from the URI scheme, accepting only \"ws\" (default 80) and \"wss\" (default 443). Any other scheme — including accidental values like null (URI without scheme), \"http\", or typos — reaches the else branch and throws. Fires during connect setup, before the handshake.","triggerScenarios":"Thrown at src/main/java/org/java_websocket/client/WebSocketClient.java:626 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a URI whose scheme is exactly \"ws\" or \"wss\", e.g. `new URI(\"wss://host:443/path\")`.","Normalize http/https URIs to ws/wss before constructing the WebSocketClient.","Check uri.getScheme() beforehand and fail fast with a clear error for unsupported schemes."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"afeacbf8c0f6f6a761c9d9daed8c813dd3b8ed7d","analyzedAt":"2026-09-09T14:39:47.546Z","contentChangedAt":"2026-09-09T14:39:47.546Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}