{"record":{"id":"7813539082153633","repo":"kubernetes/kops","slug":"error-deleting-old-autoscalinggroup-tags-v","errorCode":null,"errorMessage":"error deleting old AutoscalingGroup tags: %v","messagePattern":"error deleting old AutoscalingGroup tags: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/awstasks/autoscalinggroup.go","lineNumber":666,"sourceCode":"\t\tif changes.CapacityRebalance != nil {\n\t\t\trequest.CapacityRebalance = e.CapacityRebalance\n\t\t\tchanges.CapacityRebalance = nil\n\t\t}\n\n\t\tempty := &AutoscalingGroup{}\n\t\tif !reflect.DeepEqual(empty, changes) {\n\t\t\tklog.Warningf(\"cannot apply changes to AutoScalingGroup: %v\", changes)\n\t\t}\n\n\t\tklog.V(2).Infof(\"Updating autoscaling group %s\", fi.ValueOf(e.Name))\n\n\t\tif _, err := t.Cloud.Autoscaling().UpdateAutoScalingGroup(ctx, request); err != nil {\n\t\t\treturn fmt.Errorf(\"error updating AutoscalingGroup: %v\", err)\n\t\t}\n\n\t\tif deleteTagsRequest != nil && len(deleteTagsRequest.Tags) > 0 {\n\t\t\tif _, err := t.Cloud.Autoscaling().DeleteTags(ctx, deleteTagsRequest); err != nil {\n\t\t\t\treturn fmt.Errorf(\"error deleting old AutoscalingGroup tags: %v\", err)\n\t\t\t}\n\t\t}\n\t\tif updateTagsRequest != nil {\n\t\t\tif _, err := t.Cloud.Autoscaling().CreateOrUpdateTags(ctx, updateTagsRequest); err != nil {\n\t\t\t\treturn fmt.Errorf(\"error updating AutoscalingGroup tags: %v\", err)\n\t\t\t}\n\t\t}\n\n\t\tif detachLBRequest != nil {\n\t\t\tif _, err := t.Cloud.Autoscaling().DetachLoadBalancers(ctx, detachLBRequest); err != nil {\n\t\t\t\treturn fmt.Errorf(\"error detatching LoadBalancers: %v\", err)\n\t\t\t}\n\t\t}\n\t\tif attachLBRequest != nil {\n\t\t\tif _, err := t.Cloud.Autoscaling().AttachLoadBalancers(ctx, attachLBRequest); err != nil {\n\t\t\t\treturn fmt.Errorf(\"error attaching LoadBalancers: %v\", err)\n\t\t\t}\n\t\t}","sourceCodeStart":648,"sourceCodeEnd":684,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/awstasks/autoscalinggroup.go#L648-L684","documentation":"kops wraps the AWS AutoScaling DeleteTags API error when removing stale tags from an AutoScalingGroup during an update in RenderAWS. This happens after the ASG update succeeded but cleanup of tags that are no longer desired failed.","triggerScenarios":"During ASG update, a non-empty deleteTagsRequest is built (tags present on the ASG that are absent from the desired spec) and Autoscaling().DeleteTags fails: tag/resource not found, throttling, or missing autoscaling:DeleteTags IAM permission.","commonSituations":"Tag was already removed out-of-band so the resource version conflicts; role tag renaming (e.g. master to control-plane) causing bulk tag deletions; AWS throttling; credentials lacking DeleteTags permission.","solutions":["Re-run `kops update cluster --yes` so the delete is retried (the ASG itself was already updated; only tags are stale).","Check IAM policy includes autoscaling:DeleteTags for the kops credentials.","If throttled, retry after backoff or reduce concurrent instance-group updates.","Compare current ASG tags (`aws autoscaling describe-tags`) with the desired spec to spot manual drift, then let kops reconcile."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// ensure permissions before apply\niam.EnsurePolicy(ctx, \"autoscaling:DeleteTags\")\n// detect tag drift early\naws autoscaling describe-tags --filters Name=resource-id,Values=<asg-name> --region <region>","typeGuard":null,"tryCatchPattern":"if _, err := svc.DeleteTags(ctx, req); err != nil {\n  if isNotFoundOrThrottle(err) {\n    return retryWithBackoff(req)\n  }\n  return fmt.Errorf(\"tag cleanup failed (ASG update already applied): %w\", err)\n}","preventionTips":["Avoid manually editing ASG tags; let kops reconcile them.","Include autoscaling:DeleteTags in kops IAM policy.","Run applies with retries enabled for throttling."],"tags":["aws","autoscaling","tags","cloud-api"],"backgroundTag":"aws-api-call-failed","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"}