From 15037f382a4e728d96c24eea245ca72384d38515 Mon Sep 17 00:00:00 2001 From: Pasha Sviderski Date: Wed, 1 Apr 2026 16:14:03 +1000 Subject: [PATCH] refactor: more descriptive error for using --connect with 'uc machine init' --- cmd/uncloud/machine/init.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/uncloud/machine/init.go b/cmd/uncloud/machine/init.go index d97819e7..162de114 100644 --- a/cmd/uncloud/machine/init.go +++ b/cmd/uncloud/machine/init.go @@ -150,7 +150,10 @@ Connection methods: func initCluster(ctx context.Context, uncli *cli.CLI, remoteMachine *cli.RemoteMachine, opts initOptions) error { if uncli.Config == nil { // Config is nil when connecting directly to a remote machine (--connect) without using Uncloud config. - return fmt.Errorf("do not specify --connect when initialising a new cluster") + return fmt.Errorf( + "do not use --connect when initialising a new cluster: --connect is for overriding the connection " + + "to an existing cluster, but 'machine init' creates a new one and writes the new cluster context " + + "to the Uncloud config file (--uncloud-config)") } netPrefix, err := netip.ParsePrefix(opts.network)