From 2cfd92e0c315ec0616aea6660e28b9546cf3d28b Mon Sep 17 00:00:00 2001 From: Roman Ivanov Date: Fri, 27 Feb 2026 18:11:57 +0000 Subject: [PATCH] Use error NoSuchAccessKey in get info request processing (#1293) (#1356) Fix for https://git.deuxfleurs.fr/Deuxfleurs/garage/issues/1293 Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1356 Reviewed-by: Alex Co-authored-by: Roman Ivanov Co-committed-by: Roman Ivanov --- src/api/admin/key.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/api/admin/key.rs b/src/api/admin/key.rs index 857adca1..e8c8ad95 100644 --- a/src/api/admin/key.rs +++ b/src/api/admin/key.rs @@ -76,7 +76,9 @@ impl RequestHandler for GetKeyInfoRequest { .await? .into_iter() .collect::>(); - if candidates.len() != 1 { + if candidates.is_empty() { + return Err(Error::NoSuchAccessKey(search.clone())); + } else if candidates.len() != 1 { return Err(Error::bad_request(format!( "{} matching keys", candidates.len()