chore(neuron): log load_model failures server-side with full chain

The HTTP handler now emits a tracing::warn on load_model failures with
the expanded anyhow chain (format!("{e:#}")) before returning the 400.
journalctl -u neuron will surface the underlying hf-hub /
materialisation error without needing to capture the curl response
body separately.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-19 13:08:54 +03:00
parent f9f5fa41b6
commit 6cf87e328f

View File

@@ -69,11 +69,22 @@ async fn load_model(
let registry = state.registry.read().await; let registry = state.registry.read().await;
match registry.load_model(&spec).await { match registry.load_model(&spec).await {
Ok(()) => Json(json!({"status": "loaded"})).into_response(), Ok(()) => Json(json!({"status": "loaded"})).into_response(),
Err(e) => ( Err(e) => {
// Log the full anyhow chain server-side so journalctl shows
// the underlying failure (hf-hub timeout, permission denied,
// disk full, etc.) without needing to inspect the HTTP
// response body separately.
tracing::warn!(
model = %spec.model_id,
error = %format!("{e:#}"),
"load_model failed"
);
(
StatusCode::BAD_REQUEST, StatusCode::BAD_REQUEST,
Json(json!({"error": format!("{e:#}")})), Json(json!({"error": format!("{e:#}")})),
) )
.into_response(), .into_response()
}
} }
} }