{"record":{"id":"52afec1278119187","repo":"herdrdev/herdr","slug":"failed-to-connect-to-remote-herdr-client-socket","errorCode":null,"errorMessage":"failed to connect to remote Herdr client socket {}: {err}","messagePattern":"failed to connect to remote Herdr client socket (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/remote/host_unix.rs","lineNumber":13,"sourceCode":"//! Unix remote-host side of the SSH stdio bridge.\n\nuse std::io;\nuse std::os::unix::net::UnixStream;\nuse std::thread;\nuse std::time::Duration;\n\npub(crate) fn run_remote_client_bridge() -> io::Result<()> {\n    ensure_remote_server_running()?;\n\n    let socket_path = crate::server::socket_paths::client_socket_path();\n    let stream = UnixStream::connect(&socket_path).map_err(|err| {\n        io::Error::new(\n            err.kind(),\n            format!(\n                \"failed to connect to remote Herdr client socket {}: {err}\",\n                socket_path.display()\n            ),\n        )\n    })?;\n\n    let mut stdout = io::stdout().lock();\n    let mut socket_to_stdout = stream.try_clone()?;\n    let mut stdin_to_socket = stream;\n\n    let _upload = thread::spawn(move || {\n        let mut stdin = io::stdin();\n        let _ = copy_flush(&mut stdin, &mut stdin_to_socket);\n        let _ = stdin_to_socket.shutdown(std::net::Shutdown::Write);\n    });\n","sourceCodeStart":1,"sourceCodeEnd":31,"githubUrl":"https://github.com/herdrdev/herdr/blob/f457cff4f2648eee85d176f8a41861241d4e8428/src/remote/host_unix.rs#L1-L31","documentation":"The remote client bridge failed to connect a UnixStream to the local herdr client socket after ensuring the remote server is running. The original error kind is preserved, with the failing socket path embedded in the message. It typically indicates the server's client socket is absent, not yet listening, or permission-restricted.","triggerScenarios":"Calling run_remote_client_bridge() when client_socket_path() does not exist, the server has not bound the client socket yet, another process holds it, or filesystem permissions deny access.","commonSituations":"Server started but client socket not yet created (race), HERDR_CLIENT_SOCKET_PATH override pointing to a stale path, server crashed after startup check, socket directory removed by tmpfiles cleanup.","solutions":["Retry the bridge after a short delay to cover the socket-bind race","Verify the client socket path exists: ls -l on the path shown in the message","Inspect herdr-server.log for server-side bind failures","Unset stale HERDR_CLIENT_SOCKET_PATH overrides or point them at the live server"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"let path = crate::server::socket_paths::client_socket_path();\nif !path.exists() { /* wait or start server first */ }","typeGuard":null,"tryCatchPattern":"Err(e) if matches!(e.kind(), io::ErrorKind::ConnectionRefused | io::ErrorKind::NotFound) => retry with backoff","preventionTips":["Wait for server readiness before bridging","Keep HERDR_CLIENT_SOCKET_PATH overrides consistent","Check socket file existence before connect"],"tags":["unix-socket","connection-refused","remote","filesystem"],"backgroundTag":"connection-refused","analyzedSha":"f457cff4f2648eee85d176f8a41861241d4e8428","analyzedAt":"2026-08-28T15:41:09.197Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}