{"record":{"id":"e299a05b02198558","repo":"herdrdev/herdr","slug":"remote-bridge-upload-failed-err","errorCode":null,"errorMessage":"remote bridge upload failed: {err}","messagePattern":"remote bridge upload failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/remote/attach.rs","lineNumber":2004,"sourceCode":"        thread::sleep(BRIDGE_ACCEPT_POLL);\n    };\n    upload_stop.store(true, Ordering::Release);\n    if !child_exited {\n        connection_stop.store(true, Ordering::Release);\n    }\n    let upload_result = upload\n        .join()\n        .map_err(|_| io::Error::other(\"remote bridge upload worker panicked\"))?;\n    let download_result = download\n        .join()\n        .map_err(|_| io::Error::other(\"remote bridge download worker panicked\"))?;\n    let status = status_result?;\n\n    let stopping = bridge_stop.load(Ordering::Acquire);\n    let client_closed = client_closed.load(Ordering::Acquire);\n    if !stopping && !client_closed {\n        upload_result.map_err(|err| {\n            io::Error::new(err.kind(), format!(\"remote bridge upload failed: {err}\"))\n        })?;\n        download_result.map_err(|err| {\n            io::Error::new(err.kind(), format!(\"remote bridge download failed: {err}\"))\n        })?;\n    }\n\n    if status.success() || stopping || client_closed {\n        Ok(())\n    } else {\n        Err(io::Error::new(\n            io::ErrorKind::ConnectionAborted,\n            format!(\"ssh bridge exited with {status}\"),\n        ))\n    }\n}\n\n#[cfg(unix)]\nfn copy_flush<R: io::Read, W: io::Write>(reader: &mut R, writer: &mut W) -> io::Result<u64> {","sourceCodeStart":1986,"sourceCodeEnd":2022,"githubUrl":"https://github.com/herdrdev/herdr/blob/f457cff4f2648eee85d176f8a41861241d4e8428/src/remote/attach.rs#L1986-L2022","documentation":"After the bridge child exits, if neither the stopping nor client_closed flags are set, the upload copy thread's error is surfaced as 'remote bridge upload failed' with its kind preserved. It represents a failure while copying data from the local stream into the ssh child's stdin (the client-to-remote direction).","triggerScenarios":"Writing to ssh stdin fails mid-session: the remote side closed the connection, the ssh process died while the upload thread was still pumping, or the local stream produced a read error during the upload copy loop.","commonSituations":"Remote herdr server crash mid-attach, network drop causing ssh to exit while the pump thread is active, or the client half-closing unexpectedly.","solutions":["Check the paired download error / stderr for the root cause (usually ssh exit or remote crash)","Retry the attach after confirming the remote server is healthy (herdr server status on the remote)","Inspect remote herdr logs for a crash coinciding with the failure","Stabilize the network path (keepalives, VPN) if drops are frequent"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"match bridge_session() {\n    Err(e) if e.to_string().contains(\"upload failed\") => {\n        if remote_healthy(target) { bridge_session() } else { Err(e) }\n    }\n    r => r,\n}","preventionTips":["Check remote server health before and after bridge sessions","Log the paired download error and ssh stderr to find the root cause","Retry idempotent attach operations after transient bridge failures"],"tags":["ssh","bridge","upload","io","rust"],"backgroundTag":"stream-copy-failed","analyzedSha":"f457cff4f2648eee85d176f8a41861241d4e8428","analyzedAt":"2026-08-28T15:41:09.197Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}