From 2f71682560fd11d41bbc57f7a95731a8ad132e58 Mon Sep 17 00:00:00 2001 From: mizuki0x <197570892+mizuki0x@users.noreply.github.com> Date: Thu, 25 Jun 2026 17:10:00 +0200 Subject: [PATCH] fix(repos): log the cause when repo create fails create_repo was the one git handler that mapped its error without logging it (info_refs, receive_pack, acquire all log with repo context). So a failed init_bare returned an opaque 500 "initializing bare repo" with no server-side trail to the real cause. Log the full anyhow chain ({:#}, so the leaf git/filesystem error is kept) with owner+repo context, matching the other handlers. Response unchanged. --- crates/gitlawb-node/src/api/repos.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/gitlawb-node/src/api/repos.rs b/crates/gitlawb-node/src/api/repos.rs index 881201d..471dec1 100644 --- a/crates/gitlawb-node/src/api/repos.rs +++ b/crates/gitlawb-node/src/api/repos.rs @@ -158,7 +158,12 @@ pub async fn create_repo( .repo_store .init(&owner_did, &req.name) .await - .map_err(|e| AppError::Git(e.to_string()))?; + .map_err(|e| { + // `{:#}` walks the anyhow chain to the leaf cause; the other git + // handlers log their failures, this one didn't. + tracing::error!(owner = %owner_did, repo = %req.name, err = %format!("{e:#}"), "repo create failed"); + AppError::Git(e.to_string()) + })?; let now = Utc::now(); let record = crate::db::RepoRecord {