From c4cd8fa86adfb23719aed2ca7c650eaec8e25e18 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 22 Apr 2026 12:59:03 +0000 Subject: [PATCH] fix: fetch existing config name before PUT to avoid 400 "Name is required" When publishing updates to an existing config, the CLI skipped the name/description prompt and sent an empty name in the PUT body. The API requires name for both POST and PUT, so it rejected the request with status 400. Now we fetch the existing config's name from the API before the PUT and fall back to the slug if the fetch fails. https://claude.ai/code/session_01J6FVyNhP1uSiqHbMUYHo1i --- internal/cli/snapshot_publish.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/internal/cli/snapshot_publish.go b/internal/cli/snapshot_publish.go index 05b9f81..98b69d8 100644 --- a/internal/cli/snapshot_publish.go +++ b/internal/cli/snapshot_publish.go @@ -11,6 +11,7 @@ import ( "time" "github.com/openbootdotdev/openboot/internal/auth" + "github.com/openbootdotdev/openboot/internal/config" "github.com/openbootdotdev/openboot/internal/httputil" "github.com/openbootdotdev/openboot/internal/snapshot" syncpkg "github.com/openbootdotdev/openboot/internal/sync" @@ -51,6 +52,14 @@ func publishSnapshot(ctx context.Context, snap *snapshot.Snapshot, explicitSlug if targetSlug != "" { fmt.Fprintln(os.Stderr) fmt.Fprintf(os.Stderr, " Publishing to @%s/%s (updating)\n", stored.Username, targetSlug) + // PUT endpoint requires name; fetch the existing config to preserve it. + userSlug := fmt.Sprintf("%s/%s", stored.Username, targetSlug) + if rc, fetchErr := config.FetchRemoteConfig(userSlug, stored.Token); fetchErr == nil { + configName = rc.Name + } + if configName == "" { + configName = targetSlug + } } else { fmt.Fprintln(os.Stderr) fmt.Fprintln(os.Stderr, " Publishing as a new config on openboot.dev")