{"record":{"id":"9a7eb5b8c445da4f","repo":"kubernetes/kops","slug":"erralreadyexists","errorCode":"ErrAlreadyExists","errorMessage":"node already exists","messagePattern":"node already exists","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/bootstrap/authenticate.go","lineNumber":27,"sourceCode":"\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\npackage bootstrap\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"net/http\"\n\n\t\"k8s.io/kops/pkg/nodeidentity/clusterapi\"\n)\n\nvar ErrAlreadyExists = errors.New(\"node already exists\")\n\n// Authenticator generates authentication credentials for requests.\ntype Authenticator interface {\n\tCreateToken(body []byte) (string, error)\n}\n\n// VerifyResult is the result of a successfully verified request.\ntype VerifyResult struct {\n\t// Nodename is the name that this node is authorized to use.\n\tNodeName string\n\n\t// InstanceGroupName is the name of the kops InstanceGroup this node is a member of.\n\tInstanceGroupName string\n\n\t// CAPIMachine is the Cluster API Machine object corresponding to this node, if available.\n\tCAPIMachine *clusterapi.Machine\n\n\t// CertificateNames is the alternate names the node is authorized to use for certificates.","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/bootstrap/authenticate.go#L9-L45","documentation":"Reported when matchInstanceGroup returns an error while mapping a discovered ASG to a kops InstanceGroup in getCloudGroups. Note the ASG name is included but the underlying err is discarded, so the actual cause is hidden.","triggerScenarios":"matchInstanceGroup errors when the ASG name's machine-type suffix cannot be parsed against the cluster's instance groups — e.g. ASG naming like `nodes.foo-1234` does not correspond to any kops instance group role/spec pattern.","commonSituations":"ASG was renamed or created manually with kops cluster tags but a non-standard name; stale ASGs left from a previous cluster with the same name; instance group renamed in the kops spec while old ASGs still exist.","solutions":["Inspect the ASG name and re-create/rename the matching kops instance group","Delete the orphaned/stale ASG that carries the cluster tags but no matching instance group","Ensure ASG names follow the kops convention <instancegroup>.<clustername>","Replace the `err` in the message with `%v` wrap to expose the real cause before debugging"],"exampleFix":"// before\nreturn nil, fmt.Errorf(\"error getting instance group for ASG %q\", name)\n// after\nreturn nil, fmt.Errorf(\"error getting instance group for ASG %q: %v\", name, err)","handlingStrategy":"validation","validationCode":"for _, asg := range asgs {\n  if _, err := matchInstanceGroup(aws.ToString(asg.AutoScalingGroupName), cluster.Name, igs); err != nil {\n    klog.Warningf(\"skipping unmatchable ASG %q\", aws.ToString(asg.AutoScalingGroupName))\n  }\n}","typeGuard":"func matchesClusterASG(name, clusterName string, igs []*kops.InstanceGroup) bool {\n  return matchInstanceGroup(name, clusterName, igs) == nil\n}","tryCatchPattern":"groups, err := cloud.GetCloudGroups(ctx, cluster, igs, true, nodes)\nif err != nil && strings.Contains(err.Error(), \"error getting instance group for ASG\") {\n  // extract ASG name from %q and delete or rename the orphaned ASG\n  name := extractQuoted(err)\n  cleanupOrphanedASG(name)\n}","preventionTips":["Keep ASG names in the kops convention <instancegroup>.<clustername>","Remove leftover ASGs from old clusters sharing tags","Rename instance groups only via kops update, not manually","Improve the error to include the underlying err for debuggability"],"tags":["aws","autoscaling","instance-group","naming"],"backgroundTag":"instance-group-not-matched","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"}