From 6cf87e328f2032d4151f3a53e10945e9c156fbd7 Mon Sep 17 00:00:00 2001 From: rob thijssen Date: Tue, 19 May 2026 13:08:54 +0300 Subject: [PATCH] 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) --- crates/neuron/src/api.rs | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/crates/neuron/src/api.rs b/crates/neuron/src/api.rs index 19d108f..ba95831 100644 --- a/crates/neuron/src/api.rs +++ b/crates/neuron/src/api.rs @@ -69,11 +69,22 @@ async fn load_model( let registry = state.registry.read().await; match registry.load_model(&spec).await { Ok(()) => Json(json!({"status": "loaded"})).into_response(), - Err(e) => ( - StatusCode::BAD_REQUEST, - Json(json!({"error": format!("{e:#}")})), - ) - .into_response(), + 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, + Json(json!({"error": format!("{e:#}")})), + ) + .into_response() + } } }