{"record":{"id":"73d81c92da2ea019","repo":"kubernetes/kops","slug":"must-specify-name-of-keyset-to-distrust-keypair-in","errorCode":null,"errorMessage":"must specify name of keyset to distrust keypair in","messagePattern":"must specify name of keyset to distrust keypair in","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops/distrust_keypair.go","lineNumber":86,"sourceCode":"\tKeypairIDs  []string\n}\n\nfunc NewCmdDistrustKeypair(f *util.Factory, out io.Writer) *cobra.Command {\n\toptions := &DistrustKeypairOptions{}\n\n\tcmd := &cobra.Command{\n\t\tUse:     \"keypair {KEYSET [ID]... | all}\",\n\t\tShort:   distrustKeypairShort,\n\t\tLong:    distrustKeypairLong,\n\t\tExample: distrustKeypairExample,\n\t\tArgs: func(cmd *cobra.Command, args []string) error {\n\t\t\toptions.ClusterName = rootCommand.ClusterName(true)\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 to distrust keypair in\")\n\t\t\t}\n\t\t\toptions.Keyset = args[0]\n\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.KeypairIDs = 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) {\n\t\t\treturn completeDistrustKeyset(cmd.Context(), f, options, args, toComplete)\n\t\t},\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\treturn RunDistrustKeypair(cmd.Context(), f, out, options)","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops/distrust_keypair.go#L68-L104","documentation":"Argument validation in `kops distrust keypair`: the command requires at least one positional argument naming the keyset (KEYSET, optionally followed by keypair IDs, or 'all'), and this guard fires when none are supplied. It is a usage error before any cluster API access.","triggerScenarios":"Thrown at cmd/kops/distrust_keypair.go:86 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Specify a keyset name (e.g. 'kube-ca') or 'all': kops distrust keypair <keyset>","List keysets with kops get keypairs if unsure of the name"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}