{"record":{"id":"85c1aeb176f6e28c","repo":"kubernetes/kops","slug":"must-specify-name-of-keyset-promote-keypair-in","errorCode":null,"errorMessage":"must specify name of keyset promote keypair in","messagePattern":"must specify name of keyset promote keypair in","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops/promote_keypair.go","lineNumber":86,"sourceCode":"\n// NewCmdPromoteKeypair returns a promote keypair command.\nfunc NewCmdPromoteKeypair(f *util.Factory, out io.Writer) *cobra.Command {\n\toptions := &PromoteKeypairOptions{}\n\n\tcmd := &cobra.Command{\n\t\tUse:     \"keypair {KEYSET [ID] | all}\",\n\t\tShort:   promoteKeypairShort,\n\t\tLong:    promoteKeypairLong,\n\t\tExample: promoteKeypairExample,\n\t\tArgs: func(cmd *cobra.Command, args []string) error {\n\t\t\toptions.ClusterName = rootCommand.ClusterName(true)\n\n\t\t\tif options.ClusterName == \"\" {\n\t\t\t\treturn fmt.Errorf(\"--name is required\")\n\t\t\t}\n\n\t\t\tif len(args) == 0 {\n\t\t\t\treturn fmt.Errorf(\"must specify name of keyset promote keypair in\")\n\t\t\t}\n\n\t\t\toptions.Keyset = args[0]\n\n\t\t\tif len(args) > 2 {\n\t\t\t\treturn fmt.Errorf(\"can only promote to one keyset at a time\")\n\t\t\t}\n\t\t\tif len(args) > 1 {\n\t\t\t\tif options.Keyset == \"all\" {\n\t\t\t\t\treturn fmt.Errorf(\"cannot specify ID with \\\"all\\\"\")\n\t\t\t\t}\n\n\t\t\t\toptions.KeypairID = args[1]\n\t\t\t}\n\n\t\t\treturn nil\n\t\t},\n\t\tValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops/promote_keypair.go#L68-L104","documentation":"The promote keypair command requires the keyset name (e.g. kubernetes-ca, apiserver-aggregator-ca) as the first positional argument. With zero positional args the Args validator returns this error before the command runs.","triggerScenarios":"Running `kops promote keypair --name <cluster>` with no keyset argument at all.","commonSituations":"Copy-pasting a command and dropping the keyset argument; assuming `all` was the default; shell variable holding the keyset expanded to empty.","solutions":["Provide the keyset as the first argument, e.g. `kops promote keypair kubernetes-ca --name <cluster>`","Use `all` to promote every rotatable keyset: `kops promote keypair all --name <cluster>`","Quote/verify the shell variable that supplies the keyset name"],"exampleFix":"// before\nkops promote keypair --name mycluster.k8s.local\n// after\nkops promote keypair all --name mycluster.k8s.local","handlingStrategy":"validation","validationCode":"[ $# -ge 1 ] || { echo \"must pass keyset, e.g. kops promote keypair all --name <cluster>\"; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Quote shell variables supplying the keyset so empties fail visibly","Use `all` as the default keyset argument in scripts","Add a usage comment to promotion runbooks"],"tags":["cli","argument-validation","keypair"],"backgroundTag":"missing-positional-argument","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}