{"record":{"id":"a6218f4faa968ded","repo":"kubernetes/kops","slug":"name-is-required-a6218f","errorCode":null,"errorMessage":"--name is required","messagePattern":"--name is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops/distrust_keypair.go","lineNumber":82,"sourceCode":"\ntype DistrustKeypairOptions struct {\n\tClusterName string\n\tKeyset      string\n\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) {","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops/distrust_keypair.go#L64-L100","documentation":"The distrust keypair command's argument validator found no cluster name: rootCommand.ClusterName(true) returned empty because neither --name nor a configured default cluster is available. The command needs to know which cluster's keystore to act on.","triggerScenarios":"Thrown at cmd/kops/distrust_keypair.go:82 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass --name <clustername> to the command","Configure a default cluster name for the kops CLI"],"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-12T07:17:12.445Z"}