{"record":{"id":"ac799e9ec2fde694","repo":"rathole-org/rathole","slug":"missing-websocket-config","errorCode":null,"errorMessage":"Missing websocket config","messagePattern":"Missing websocket config","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/transport/websocket.rs","lineNumber":195,"sourceCode":"}\n\n#[derive(Debug)]\npub struct WebsocketTransport {\n    sub: SubTransport,\n    conf: WebSocketConfig,\n}\n\n#[async_trait]\nimpl Transport for WebsocketTransport {\n    type Acceptor = TcpListener;\n    type RawStream = TcpStream;\n    type Stream = WebsocketTunnel;\n\n    fn new(config: &TransportConfig) -> anyhow::Result<Self> {\n        let wsconfig = config\n            .websocket\n            .as_ref()\n            .ok_or_else(|| anyhow!(\"Missing websocket config\"))?;\n\n        let conf = WebSocketConfig {\n            write_buffer_size: 0,\n            ..WebSocketConfig::default()\n        };\n        let sub = match wsconfig.tls {\n            true => SubTransport::Secure(TlsTransport::new(config)?),\n            false => SubTransport::Insecure(TcpTransport::new(config)?),\n        };\n        Ok(WebsocketTransport { sub, conf })\n    }\n\n    fn hint(conn: &Self::Stream, opt: SocketOpts) {\n        opt.apply(conn.inner.get_ref().inner.get_ref().get_tcpstream())\n    }\n\n    async fn bind<A: ToSocketAddrs + Send + Sync>(\n        &self,","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/rathole-org/rathole/blob/a292f7ed5402f840415fc6a53827da2f34337856/src/transport/websocket.rs#L177-L213","documentation":"The websocket transport requires a `[transport.websocket]` section (which also decides whether TLS is used underneath). When `config.websocket` is None, the constructor at src/transport/websocket.rs:195 returns this error. Without it the transport cannot know the websocket path, headers, or TLS mode.","triggerScenarios":"Setting transport type to websocket while omitting the websocket section from TransportConfig.","commonSituations":"Migrating from tcp/tls to websocket transport without updating the config; a reverse-proxy deployment where users forget the websocket-specific keys; configs edited by hand that dropped the websocket table.","solutions":["Add a `[transport.websocket]` section to the config (including `tls = true/false` and any path/header settings).","If websocket is unnecessary, switch transport type to tcp or tls instead.","Verify the exact field names against the repository's example websocket config.","Re-check that the runtime config path points to the updated file."],"exampleFix":"# before\n[transport]\ntype = \"websocket\"\n\n# after\n[transport]\ntype = \"websocket\"\n[transport.websocket]\ntls = true\npath = \"/ws\"","handlingStrategy":"validation","validationCode":"let raw = std::fs::read_to_string(config_path)?;\nlet cfg: toml::Value = toml::from_str(&raw)?;\nif cfg.get(\"transport\").and_then(|t| t.get(\"websocket\")).is_none() {\n    anyhow::bail!(\"websocket transport requires [transport.websocket] in config\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Copy the websocket example config when switching transports","Set the tls flag explicitly inside the websocket block","Validate config before launch"],"tags":["websocket","config","transport","missing-config"],"backgroundTag":"missing-required-config-field","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"}