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/cli/agent.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/cli/agent.rs') diff --git a/src/cli/agent.rs b/src/cli/agent.rs index e48d6b3b..e1271f48 100644 --- a/src/cli/agent.rs +++ b/src/cli/agent.rs @@ -577,6 +577,13 @@ fn print_agent_transport_error( if super::protocol_mismatch_was_reported(&err) { return Ok(1); } + // A dead-server marker reaches here from `send_request` in the agent + // startup path; surface its deferred response exactly once instead of + // printing a second, generic transport-error line. + if let Some(response) = super::server_not_running_reported_response(&err) { + let value = serde_json::to_value(response).map_err(std::io::Error::other)?; + return super::print_response(&value); + } super::print_response(&cli_agent_error(request_id, code, err.to_string())) } -- cgit v1.2.3