From bda7c20dfa262bf84a70e90be9eecc7ab1f68354 Mon Sep 17 00:00:00 2001 From: Sagar Tamang Date: Mon, 24 Aug 2026 17:25:17 +0530 Subject: [PATCH] fix: cake serve fails with "required argument was not provided: address" `cake serve ` is unusable in any release build: $ cake serve evilsocket/Qwen3-0.6B error: The following required argument was not provided: address Usage: cake Clap derives an argument's ID from the field name, not from the `long` attribute. The `Serve` variant declares a field named `address` (exposed as `--api`) and also flattens `Args`, which has its own `address` field (exposed as `--address`). Both register under the ID "address" in the same command. Clap validates ID uniqueness with debug assertions, which are compiled out by `--release`. Instead of panicking, the resulting command has a malformed argument table: both default values are dropped, "address" is treated as required, and the usage line degenerates to `cake `. `Run` is unaffected -- it flattens `Args` without declaring an `address` field of its own, so `cake run --api ` works and is an exact workaround, since `Serve` only sets `args.api` before delegating to the same code path. Fixed by renaming the field to `api_address`, which removes the collision and makes the field name match the flag it produces, so the clash is harder to reintroduce. No flags change: `--api` and `--address` behave as documented. Co-Authored-By: Claude Opus 5 --- cake-cli/src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cake-cli/src/main.rs b/cake-cli/src/main.rs index 96f5996..dd3aea3 100644 --- a/cake-cli/src/main.rs +++ b/cake-cli/src/main.rs @@ -44,7 +44,7 @@ enum Commands { model: String, /// API bind address #[arg(long = "api", default_value = "0.0.0.0:8080")] - address: String, + api_address: String, #[command(flatten)] args: Args, }, @@ -135,9 +135,9 @@ async fn main() -> Result<()> { } } } - Commands::Serve { model, address, mut args } => { + Commands::Serve { model, api_address, mut args } => { args.model = model; - args.api = Some(address); + args.api = Some(api_address); args.mode = Mode::Master; run_as_master(args).await }