{"record":{"id":"dff366e0afe3eef1","repo":"kubernetes/kops","slug":"too-many-arguments","errorCode":null,"errorMessage":"too many arguments","messagePattern":"too many arguments","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops/delete_secret.go","lineNumber":69,"sourceCode":"\tcmd := &cobra.Command{\n\t\tUse:     \"secret SECRET_NAME...\",\n\t\tShort:   deleteSecretShort,\n\t\tExample: deleteSecretExample,\n\t\tArgs: func(cmd *cobra.Command, args []string) error {\n\t\t\tif len(args) > 0 && args[0] == \"sshpublickey\" {\n\t\t\t\toptions.SecretType = args[0]\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tif len(args) > 0 && args[0] == \"secret\" {\n\t\t\t\targs = args[1:]\n\t\t\t}\n\n\t\t\tif len(args) == 0 {\n\t\t\t\treturn fmt.Errorf(\"secret name is required\")\n\t\t\t}\n\t\t\tif len(args) > 1 {\n\t\t\t\treturn fmt.Errorf(\"too many arguments\")\n\t\t\t}\n\t\t\toptions.SecretNames = args\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\treturn nil\n\t\t},\n\t\tValidArgsFunction: completeSecretNames(f),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\treturn RunDeleteSecret(cmd.Context(), f, out, options)\n\t\t},\n\t}\n\n\treturn cmd\n}","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops/delete_secret.go#L51-L87","documentation":"The delete secret command accepts at most one secret name. Passing more than one positional argument triggers \"too many arguments\". The CLI intentionally does not support batch deletion in one invocation.","triggerScenarios":"`kops delete secret name1 name2 ...` with two or more positional args after stripping the optional \"secret\" keyword.","commonSituations":"Attempting batch deletion; passing extra flags positionally or quoting mistakes that split one name into multiple args.","solutions":["Run the command once per secret: kops delete secret <name> --name <cluster>","Quote names containing spaces: kops delete secret \"my secret\"","Check `kops delete secret --help` for accepted argument count"],"exampleFix":"// before\nkops delete secret dockerconfig admin --name mycluster.k8s.local\n// after\nkops delete secret dockerconfig --name mycluster.k8s.local\nkops delete secret admin --name mycluster.k8s.local","handlingStrategy":"validation","validationCode":"# shell: ensure only one positional arg\nset -- \"$@\"\nif [ \"$#\" -ne 1 ]; then echo \"pass exactly one secret name\"; exit 1; fi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Delete secrets one at a time; the CLI supports a single name per call","Quote secret names containing spaces so they count as one argument","Check --help output for accepted argument counts"],"tags":["cli","secrets","argument-validation"],"backgroundTag":"too-many-arguments","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"}