{"record":{"id":"a59ec735f53eebee","repo":"herdrdev/herdr","slug":"remote-bridge-download-failed-err","errorCode":null,"errorMessage":"remote bridge download failed: {err}","messagePattern":"remote bridge download failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/remote/attach.rs","lineNumber":2007,"sourceCode":"    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> {\n    let mut buffer = [0_u8; 16 * 1024];\n    let mut total = 0;\n","sourceCodeStart":1989,"sourceCodeEnd":2025,"githubUrl":"https://github.com/herdrdev/herdr/blob/f457cff4f2648eee85d176f8a41861241d4e8428/src/remote/attach.rs#L1989-L2025","documentation":"The companion of the upload error: with the bridge exited and not stopping/client-closed, the download copy thread (ssh stdout back to the local stream) failed, and its error is surfaced with the kind preserved. It represents the remote-to-client relay breaking.","triggerScenarios":"Reading from ssh stdout fails or the local stream write fails during the download pump: remote process termination, socket reset, or the local client disconnecting abruptly while data was in flight.","commonSituations":"Remote herdr server exiting mid-session, network reset (RST) on long-lived bridges, or local backpressure/write errors when the TUI client is gone.","solutions":["Check remote herdr server logs for the reason it stopped","Verify network stability and enable SSH keepalives","Re-run the attach; transient resets usually recover","If reproducible at a consistent point, capture remote stderr (inherited) alongside the failure"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"for attempt in 0..2 {\n    match bridge_session() {\n        Err(e) if e.to_string().contains(\"download failed\") if attempt == 0 => continue,\n        r => break r,\n    }\n}?","preventionTips":["Enable SSH keepalives to detect dead connections early","Watch remote herdr logs for crashes that reset the download pump"],"tags":["ssh","bridge","download","io","rust"],"backgroundTag":"stream-copy-failed","analyzedSha":"f457cff4f2648eee85d176f8a41861241d4e8428","analyzedAt":"2026-08-28T15:41:09.197Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}