{"record":{"id":"58ea5bee824e62d4","repo":"ekzhang/bore","slug":"unexpected-initial-non-hello-message","errorCode":null,"errorMessage":"unexpected initial non-hello message","messagePattern":"unexpected initial non-hello message","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/client.rs","lineNumber":56,"sourceCode":"        local_port: u16,\n        to: &str,\n        port: u16,\n        secret: Option<&str>,\n    ) -> Result<Self> {\n        let mut stream = Delimited::new(connect_with_timeout(to, CONTROL_PORT).await?);\n        let auth = secret.map(Authenticator::new);\n        if let Some(auth) = &auth {\n            auth.client_handshake(&mut stream).await?;\n        }\n\n        stream.send(ClientMessage::Hello(port)).await?;\n        let remote_port = match stream.recv_timeout().await? {\n            Some(ServerMessage::Hello(remote_port)) => remote_port,\n            Some(ServerMessage::Error(message)) => bail!(\"server error: {message}\"),\n            Some(ServerMessage::Challenge(_)) => {\n                bail!(\"server requires authentication, but no client secret was provided\");\n            }\n            Some(_) => bail!(\"unexpected initial non-hello message\"),\n            None => bail!(\"unexpected EOF\"),\n        };\n        info!(remote_port, \"connected to server\");\n        info!(\"listening at {to}:{remote_port}\");\n\n        Ok(Client {\n            conn: Some(stream),\n            to: to.to_string(),\n            local_host: local_host.to_string(),\n            local_port,\n            remote_port,\n            auth,\n        })\n    }\n\n    /// Returns the port publicly available on the remote.\n    pub fn remote_port(&self) -> u16 {\n        self.remote_port","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/ekzhang/bore/blob/00a735a89917642df62d84336a90d9476fa175b5/src/client.rs#L38-L74","documentation":"In `Client::new`, the first server message after the handshake was neither `Hello`, `Error`, nor `Challenge` — an unexpected message variant arrived where the protocol requires `Hello(remote_port)`. This indicates the remote endpoint is not speaking the expected bore protocol or the stream is desynchronized.","triggerScenarios":"Connecting to a port not actually served by a compatible bore server; a proxy returning an HTTP banner or other protocol data; a mismatched protocol version re-framing messages incorrectly.","commonSituations":"Wrong port forwarded to a non-bore service; a reverse proxy or load balancer intercepting the TCP connection; client and server versions with incompatible message enums; connecting to an HTTP endpoint by mistake.","solutions":["Verify the target host:port actually runs a bore server (`bore server`).","Check for proxies/load balancers that might answer before the bore server does.","Ensure client and server use compatible bore versions.","Confirm you are not connecting to the HTTP control port of another service."],"exampleFix":"// before (wrong port: HTTP service)\nbore local 3000 --to example.com --port 80\n// after (port where bore server listens)\nbore local 3000 --to example.com --port 2200","handlingStrategy":"validation","validationCode":"// Sanity-check the endpoint before connecting\nassert!(!to_host.contains(\"http\"), \"use a TCP host:port, not a URL\");\n// Verify a bore server is listening on that port before Client::new","typeGuard":null,"tryCatchPattern":"match Client::new(...).await {\n    Err(e) if e.to_string().contains(\"unexpected initial non-hello message\") => {\n        eprintln!(\"target is not a compatible bore server; check host/port/version\");\n        std::process::exit(2);\n    }\n    other => other,\n}","preventionTips":["Record the bore server's port in config rather than guessing.","Test the endpoint with a known-good bore client after server upgrades.","Bypass or correctly configure TCP proxies in front of the bore server."],"tags":["protocol","network","unexpected-response"],"backgroundTag":"unexpected-api-response-shape","analyzedSha":"00a735a89917642df62d84336a90d9476fa175b5","analyzedAt":"2026-09-08T13:27:32.996Z","contentChangedAt":"2026-09-08T13:27:32.996Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}