herdrdev/herdr · error
failed to determine herdr executable path: {err}
Error message
failed to determine herdr executable path: {err} What it means
spawn_server_daemon could not resolve the path of the currently running herdr executable via std::env::current_exe(). Without the executable path the daemon cannot re-spawn itself as a background server. The underlying OS error kind and message are preserved.
Source
Thrown at src/server/autodetect.rs:191
}
// ---------------------------------------------------------------------------
// Server spawning
// ---------------------------------------------------------------------------
/// Spawns the herdr server as a background daemon process.
///
/// The server process is fully detached:
/// - Runs in its own session (setsid) so it survives the client exiting
/// - Stdin/stdout/stderr are redirected to /dev/null
/// - Inherits relevant environment variables (`XDG_CONFIG_HOME`, `HERDR_SESSION`,
/// socket overrides, etc.), except inherited socket overrides are cleared when
/// this CLI invocation explicitly selected a session.
///
/// Returns the PID of the spawned server process.
pub fn spawn_server_daemon() -> io::Result<u32> {
let exe = std::env::current_exe().map_err(|err| {
io::Error::new(
err.kind(),
format!("failed to determine herdr executable path: {err}"),
)
})?;
info!(exe = %exe.display(), "spawning server daemon");
let mut command = build_server_daemon_command(exe);
let pid =
crate::platform::launch_server_daemon_command(&mut command).map_err(|err: io::Error| {
io::Error::new(err.kind(), format!("failed to spawn herdr server: {err}"))
})?;
info!(pid, "server daemon spawned");
Ok(pid)
}
View on GitHub (pinned to f457cff4f2)
Solutions
- Restart herdr from a stable, non-replaced binary location
- If this happens right after an update, exit the old session and launch the new binary
- Verify /proc is mounted (Linux) and the binary file still exists at its original path
- Avoid deleting/replacing the herdr binary while sessions are running
Defensive patterns
Strategy: fallback
Validate before calling
let exe = std::env::current_exe().map(|p| p.to_path_buf()).ok();
Prevention
- Avoid replacing the herdr binary while it runs
- Pin a stable install location for the binary
- Restart sessions after self-updates
When it happens
Trigger: std::env::current_exe() failing: the binary was deleted or replaced while running (common after `herdr update` overwriting the running binary on some platforms), /proc not mounted on Linux, or exec-path retrieval unsupported in the environment.
Common situations: Self-update replaced the binary mid-run, running from a deleted temp file, containers with restricted /proc, or unusual exec environments.
Related errors
- failed to start ssh install: {err}
- login shell {shell:?} was not found on PATH
- ssh bootstrap stdin missing
- ssh install stdin missing
- download failed: {err}
AI-assisted analysis of herdrdev/herdr@f457cff4f2 (2026-08-28).
Data as JSON: /api/errors/e55972eac7d503ee.
Report an issue: GitHub.