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/status.rs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'src/cli/status.rs') diff --git a/src/cli/status.rs b/src/cli/status.rs index 49b3c129..74bb3e2a 100644 --- a/src/cli/status.rs +++ b/src/cli/status.rs @@ -159,20 +159,13 @@ fn read_server_runtime_status() -> std::io::Result { protocol: status.protocol, capabilities: status.capabilities, }), - Err(ApiClientError::Io(err)) if server_not_running_error(&err) => { + Err(ApiClientError::Io(err)) if super::server_not_running_error(&err) => { Ok(ServerRuntimeStatus::NotRunning) } Err(err) => Err(api_client_error_to_io(err)), } } -fn server_not_running_error(err: &std::io::Error) -> bool { - matches!( - err.kind(), - std::io::ErrorKind::NotFound | std::io::ErrorKind::ConnectionRefused - ) -} - fn api_client_error_to_io(err: ApiClientError) -> std::io::Error { match err { ApiClientError::Io(err) => err, -- cgit v1.2.3