diff --git a/go/cmd/vtctldclient/command/root.go b/go/cmd/vtctldclient/command/root.go index c36dfb8575f..1194b49ec8f 100644 --- a/go/cmd/vtctldclient/command/root.go +++ b/go/cmd/vtctldclient/command/root.go @@ -141,6 +141,13 @@ func getClientForCommand(cmd *cobra.Command) (vtctldclient.VtctldClient, error) } } + // Reserved cobra commands for shell completion that we don't want to fail + // here. + switch { + case cmd.Name() == "__complete", cmd.Parent() != nil && cmd.Parent().Name() == "completion": + return nil, nil + } + if VtctldClientProtocol != "local" && server == "" { return nil, errNoServer }