herdrdev/herdr · error

remote bridge download failed: {err}

Error message

remote bridge download failed: {err}

What it means

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.

Source

Thrown at src/remote/attach.rs:2007

    if !child_exited {
        connection_stop.store(true, Ordering::Release);
    }
    let upload_result = upload
        .join()
        .map_err(|_| io::Error::other("remote bridge upload worker panicked"))?;
    let download_result = download
        .join()
        .map_err(|_| io::Error::other("remote bridge download worker panicked"))?;
    let status = status_result?;

    let stopping = bridge_stop.load(Ordering::Acquire);
    let client_closed = client_closed.load(Ordering::Acquire);
    if !stopping && !client_closed {
        upload_result.map_err(|err| {
            io::Error::new(err.kind(), format!("remote bridge upload failed: {err}"))
        })?;
        download_result.map_err(|err| {
            io::Error::new(err.kind(), format!("remote bridge download failed: {err}"))
        })?;
    }

    if status.success() || stopping || client_closed {
        Ok(())
    } else {
        Err(io::Error::new(
            io::ErrorKind::ConnectionAborted,
            format!("ssh bridge exited with {status}"),
        ))
    }
}

#[cfg(unix)]
fn copy_flush<R: io::Read, W: io::Write>(reader: &mut R, writer: &mut W) -> io::Result<u64> {
    let mut buffer = [0_u8; 16 * 1024];
    let mut total = 0;

View on GitHub (pinned to f457cff4f2)

Solutions

  1. Check remote herdr server logs for the reason it stopped
  2. Verify network stability and enable SSH keepalives
  3. Re-run the attach; transient resets usually recover
  4. If reproducible at a consistent point, capture remote stderr (inherited) alongside the failure
Defensive patterns

Strategy: retry

Try / catch

for attempt in 0..2 {
    match bridge_session() {
        Err(e) if e.to_string().contains("download failed") if attempt == 0 => continue,
        r => break r,
    }
}?

Prevention

When it happens

Trigger: 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.

Common situations: Remote herdr server exiting mid-session, network reset (RST) on long-lived bridges, or local backpressure/write errors when the TUI client is gone.

Related errors


AI-assisted analysis of herdrdev/herdr@f457cff4f2 (2026-08-28). Data as JSON: /api/errors/a59ec735f53eebee. Report an issue: GitHub.