{"record":{"id":"734b7de1b81c7f49","repo":"kubernetes/kops","slug":"must-specify-id-of-instance-or-name-of-node-to-del","errorCode":null,"errorMessage":"must specify ID of instance or name of node to delete","messagePattern":"must specify ID of instance or name of node to delete","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops/delete_instance.go","lineNumber":128,"sourceCode":"\n\tdeleteInstanceShort := i18n.T(`Delete an instance.`)\n\n\tvar options DeleteInstanceOptions\n\toptions.initDefaults()\n\n\tcmd := &cobra.Command{\n\t\tUse:     \"instance INSTANCE|NODE\",\n\t\tShort:   deleteInstanceShort,\n\t\tLong:    deleteInstanceLong,\n\t\tExample: deleteInstanceExample,\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 ID of instance or name of node to delete\")\n\t\t\t}\n\t\t\toptions.InstanceID = args[0]\n\n\t\t\tif len(args) != 1 {\n\t\t\t\treturn fmt.Errorf(\"can only delete one instance at a time\")\n\t\t\t}\n\n\t\t\treturn nil\n\t\t},\n\t\tValidArgsFunction: completeInstanceOrNode(f, &options),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\treturn RunDeleteInstance(cmd.Context(), f, out, &options)\n\t\t},\n\t}\n\n\tcmd.Flags().BoolVar(&options.CloudOnly, \"cloudonly\", options.CloudOnly, \"Perform deletion update without confirming progress with Kubernetes\")\n\tcmd.Flags().BoolVar(&options.Surge, \"surge\", options.Surge, \"Surge by detaching the node from the ASG before deletion\")\n","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops/delete_instance.go#L110-L146","documentation":"The delete instance command's argument validator requires the cloud instance ID or Kubernetes node name as a positional argument; this fires when no positional args were given, so there is nothing to identify the instance to delete.","triggerScenarios":"Running `kops delete instance` with flags only and no instance ID/node name argument.","commonSituations":"Users expecting an interactive picker or --all style flag; scripts where the instance ID variable was empty.","solutions":["Provide the instance ID or node name: `kops delete instance i-0abc123`.","If scripting, verify the variable holding the ID is non-empty before invoking kops.","List instances first (`kops get instances` / kubectl get nodes) to find the correct identifier."],"exampleFix":"// before\nkops delete instance --name cluster.example.com\n// after\nkops delete instance i-0abc123 --name cluster.example.com","handlingStrategy":"validation","validationCode":"instanceID := os.Getenv(\"INSTANCE_ID\")\nif instanceID == \"\" {\n    return fmt.Errorf(\"instance ID must be resolved before calling kops delete instance\")\n}\nargs = append(args, instanceID)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check that the positional argument variable is non-empty before invoking.","Fetch the instance ID via `kops get instances` first.","Use shell `set -u` to catch unset variables in scripts."],"tags":["cli","validation","missing-argument"],"backgroundTag":"missing-required-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"}