{"record":{"id":"f5835e097e7a5779","repo":"kubernetes/kops","slug":"invalid-instance-group-role-q","errorCode":null,"errorMessage":"invalid instance group role %q","messagePattern":"invalid instance group role %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops/rolling-update_cluster.go","lineNumber":331,"sourceCode":"\t\t\t\treturn fmt.Errorf(\"InstanceGroup %q not found\", instanceGroupName)\n\t\t\t}\n\n\t\t\tfiltered = append(filtered, found)\n\t\t}\n\n\t\tinstanceGroups = filtered\n\n\t\t// Don't warn if we find more ASGs than IGs\n\t\twarnUnmatched = false\n\t}\n\n\tif len(options.InstanceGroupRoles) != 0 {\n\t\tvar filtered []*kopsapi.InstanceGroup\n\n\t\tfor _, role := range options.InstanceGroupRoles {\n\t\t\ts, f := kopsapi.ParseInstanceGroupRole(role, true)\n\t\t\tif !f {\n\t\t\t\treturn fmt.Errorf(\"invalid instance group role %q\", role)\n\t\t\t}\n\t\t\tfor _, ig := range instanceGroups {\n\t\t\t\tif ig.Spec.Role == s {\n\t\t\t\t\tfiltered = append(filtered, ig)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tinstanceGroups = filtered\n\n\t\t// Don't warn if we find more ASGs than IGs\n\t\twarnUnmatched = false\n\t}\n\n\tcloud, err := cloudup.BuildCloud(cluster)\n\tif err != nil {\n\t\treturn err\n\t}","sourceCodeStart":313,"sourceCodeEnd":349,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops/rolling-update_cluster.go#L313-L349","documentation":"When --role (options.InstanceGroupRoles) is supplied, each role string is parsed with kopsapi.ParseInstanceGroupRole(role, true). If parsing fails — the string is not a valid InstanceGroupRole value — the command returns \"invalid instance group role %q\". Only canonical role names (control-plane/master, node, bastion, apiserver...) are accepted.","triggerScenarios":"options.InstanceGroupRoles contains a string that kopsapi.ParseInstanceGroupRole does not recognize, e.g. --role worker, --role Node (case sensitivity), or --role control_plane.","commonSituations":"Using pre-1.24 terminology like \"master\" after role renames, or vice versa; guessing role names like \"worker\" or \"etcd\"; shell completing a truncated value.","solutions":["Use one of the valid values printed by kops help rolling-update cluster (e.g. control-plane, node, bastion)","Check kopsapi.ParseInstanceGroupRole / InstanceGroupRole constants in k8s.io/kops/pkg/apis/kops for the exact accepted strings for your kops version","Drop the --role flag to consider all instance groups"],"exampleFix":"// before\nkops rolling-update cluster mycluster.k8s.local --role worker\n// error: invalid instance group role \"worker\"\n// after\nkops rolling-update cluster mycluster.k8s.local --role node","handlingStrategy":"validation","validationCode":"// validate role string against kopsapi roles before invoking\nvalid := map[string]bool{\"control-plane\": true, \"master\": true, \"node\": true, \"bastion\": true, \"apiserver\": true}\nif !valid[role] {\n    return fmt.Errorf(\"role %q invalid; use one of: control-plane, node, bastion, apiserver\", role)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check `kops rolling-update cluster --help` for accepted --role values for your kops version","Use exact lowercase canonical names; avoid legacy synonyms unless supported","Pin the kops version in scripts so role vocabulary is stable","Verify against kopsapi.ParseInstanceGroupRole in the matching kops source"],"tags":["instancegroup","validation","cli-flags"],"backgroundTag":"invalid-enum-value","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"}