From 8652055458f23cf0f8bad4cae77fe192ea9907a2 Mon Sep 17 00:00:00 2001 From: Douwe Osinga Date: Mon, 16 Mar 2026 14:49:59 -0400 Subject: [PATCH] Log 500 errors and also show error for direct download (#7936) Co-authored-by: Douwe Osinga --- crates/goose-server/src/routes/errors.rs | 6 ++++++ .../settings/localInference/HuggingFaceModelSearch.tsx | 10 ++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/crates/goose-server/src/routes/errors.rs b/crates/goose-server/src/routes/errors.rs index 43835e3d97..0866f81293 100644 --- a/crates/goose-server/src/routes/errors.rs +++ b/crates/goose-server/src/routes/errors.rs @@ -48,6 +48,12 @@ impl ErrorResponse { impl IntoResponse for ErrorResponse { fn into_response(self) -> Response { + if self.status.is_server_error() { + tracing::error!(status = %self.status, message = %self.message, "server error response"); + } else if self.status.is_client_error() { + tracing::warn!(status = %self.status, message = %self.message, "client error response"); + } + let body = Json(serde_json::json!({ "message": self.message, })); diff --git a/ui/desktop/src/components/settings/localInference/HuggingFaceModelSearch.tsx b/ui/desktop/src/components/settings/localInference/HuggingFaceModelSearch.tsx index dc6ea05fc9..6297e6a74e 100644 --- a/ui/desktop/src/components/settings/localInference/HuggingFaceModelSearch.tsx +++ b/ui/desktop/src/components/settings/localInference/HuggingFaceModelSearch.tsx @@ -8,6 +8,8 @@ import { type HfModelInfo, type HfQuantVariant, } from '../../../api'; +import { toastError } from '../../../toasts'; +import { errorMessage } from '../../../utils/conversionUtils'; const formatBytes = (bytes: number): string => { if (bytes === 0) return 'unknown'; @@ -178,14 +180,18 @@ export const HuggingFaceModelSearch = ({ onDownloadStarted }: Props) => { setDownloading((prev) => new Set(prev).add(key)); try { const response = await downloadHfModel({ - body: { spec }, + body: { spec }, throwOnError: true }); if (response.data) { onDownloadStarted(response.data); setDirectSpec(''); } } catch (e) { - console.error('Direct download failed:', e); + toastError({ + title: 'Direct download failed', + msg: 'Failed to start the download. Check the spec: ' + errorMessage(e), + }); + } finally { setDownloading((prev) => { const next = new Set(prev);