From ca5c8e9717ff86150c76b688c24bf947b6dadad5 Mon Sep 17 00:00:00 2001 From: tristantr Date: Wed, 10 Jun 2026 16:35:29 +0200 Subject: [PATCH] fix(hub_publish): return 400 not 500 when HUB_DEV_TOKEN is unset Missing config is a client/config error, not a server fault. Restores the BadRequest class lost when hub_token() was extracted. Co-Authored-By: Claude Opus 4.8 (1M context) --- backend/windmill-api/src/hub_publish.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/windmill-api/src/hub_publish.rs b/backend/windmill-api/src/hub_publish.rs index 7c0e5625b6..753c9c7b82 100644 --- a/backend/windmill-api/src/hub_publish.rs +++ b/backend/windmill-api/src/hub_publish.rs @@ -362,7 +362,12 @@ async fn submit_project( } fn hub_token() -> Result { - std::env::var("HUB_DEV_TOKEN").map_err(|_| Error::InternalErr("HUB_DEV_TOKEN not set".into())) + // Missing config, not a server fault: surface a clear 400 rather than a 500. + std::env::var("HUB_DEV_TOKEN").map_err(|_| { + Error::BadRequest( + "Hub publishing is not configured on this instance (HUB_DEV_TOKEN not set)".into(), + ) + }) } async fn get_from_hub(path: &str, source_id: &str) -> Result<(StatusCode, String), Error> {