{"record":{"id":"8b18d3b40014c90e","repo":"rathole-org/rathole","slug":"failed-to-connect","errorCode":null,"errorMessage":"failed to connect","messagePattern":"failed to connect","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/transport/websocket.rs","lineNumber":248,"sourceCode":"            SubTransport::Secure(t) => TransportStream::Secure(t.handshake(conn).await?),\n        };\n        let wsstream = accept_async_with_config(tsream, Some(self.conf)).await?;\n        let tun = WebsocketTunnel {\n            inner: StreamReader::new(StreamWrapper { inner: wsstream }),\n        };\n        Ok(tun)\n    }\n\n    async fn connect(&self, addr: &AddrMaybeCached) -> anyhow::Result<Self::Stream> {\n        let u = format!(\"ws://{}\", &addr.addr.as_str());\n        let url = Url::parse(&u).unwrap();\n        let tstream = match &self.sub {\n            SubTransport::Insecure(t) => TransportStream::Insecure(t.connect(addr).await?),\n            SubTransport::Secure(t) => TransportStream::Secure(t.connect(addr).await?),\n        };\n        let (wsstream, _) = client_async_with_config(url, tstream, Some(self.conf))\n            .await\n            .expect(\"failed to connect\");\n        let tun = WebsocketTunnel {\n            inner: StreamReader::new(StreamWrapper { inner: wsstream }),\n        };\n        Ok(tun)\n    }\n}\n","sourceCodeStart":230,"sourceCodeEnd":255,"githubUrl":"https://github.com/rathole-org/rathole/blob/a292f7ed5402f840415fc6a53827da2f34337856/src/transport/websocket.rs#L230-L255","documentation":"Fires in the websocket transport's connect: after building ws://<addr> and completing the underlying sub-transport (insecure TCP or TLS) connection and handshake, the WebSocket client handshake with the server failed, so no WebSocket stream could be established to the given address. Common causes are the remote endpoint not speaking WebSocket, a wrong path/upgrade response, or TLS failure underneath.","triggerScenarios":"Thrown at src/transport/websocket.rs:248 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the target address is a rathole server endpoint with WebSocket transport enabled","Check the URL scheme/path matches what the server expects (ws:// vs wss:// per TLS settings)","Confirm TLS certificates and SNI are valid when the secure sub-transport is used","Check proxies/firewalls that may strip WebSocket Upgrade headers"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a292f7ed5402f840415fc6a53827da2f34337856","analyzedAt":"2026-09-07T09:56:55.739Z","contentChangedAt":"2026-09-07T09:56:55.739Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}