From f99647b2c2d7fbfd11269330a25ea4f9be59bafa Mon Sep 17 00:00:00 2001 From: Season Saw Date: Sat, 1 Aug 2026 21:17:23 +0800 Subject: fix: report a clear cli error when no herdr server is running (#1963) * fix: report a clear cli error when no herdr server is running socket cli commands surfaced a raw io::Error debug string (`Error: Os { code: 2, ... }`) when nothing was listening on the api socket, which read like a bad --cwd path. map dead-socket connect failures to a `server_not_running` json error carrying the resolved socket path, printed once at the edge that surfaces the error; recovering callers (plugin offline registry fallback, agent start polling) recognize the marker and keep their existing behavior. refs #1941 * fix: map dead-socket errors on the unchecked cli request path refs #1941 * fix: make server-not-running guidance session-aware refs #1941 --- src/main.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 8fc51d6b..7b4058d2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -497,6 +497,14 @@ fn main() -> io::Result<()> { Ok(cli::CommandOutcome::Handled(code)) => std::process::exit(code), Ok(cli::CommandOutcome::NotCli) => {} Err(err) if cli::protocol_mismatch_was_reported(&err) => std::process::exit(1), + Err(err) if cli::server_not_running_was_reported(&err) => { + if let Some(response) = cli::server_not_running_reported_response(&err) { + if let Ok(json) = serde_json::to_string(response) { + eprintln!("{json}"); + } + } + std::process::exit(1); + } Err(err) => return Err(err), } -- cgit v1.2.3