{"record":{"id":"e13cda6996b25dab","repo":"kubernetes/kops","slug":"error-deleting-autoscaling-group-q-v","errorCode":null,"errorMessage":"error deleting autoscaling group %q: %v","messagePattern":"error deleting autoscaling group %q: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/resources/aws/aws.go","lineNumber":1247,"sourceCode":"\nfunc DeleteAutoScalingGroup(cloud fi.Cloud, r *resources.Resource) error {\n\tctx := context.TODO()\n\n\tc := cloud.(awsup.AWSCloud)\n\n\tid := r.ID\n\n\tklog.V(2).Infof(\"Deleting autoscaling group %q\", id)\n\trequest := &autoscaling.DeleteAutoScalingGroupInput{\n\t\tAutoScalingGroupName: &id,\n\t\tForceDelete:          aws.Bool(true),\n\t}\n\t_, err := c.Autoscaling().DeleteAutoScalingGroup(ctx, request)\n\tif err != nil {\n\t\tif IsDependencyViolation(err) {\n\t\t\treturn err\n\t\t}\n\t\treturn fmt.Errorf(\"error deleting autoscaling group %q: %v\", id, err)\n\t}\n\treturn nil\n}\n\nfunc ListAutoScalingGroups(cloud fi.Cloud, vpcID, clusterName string) ([]*resources.Resource, error) {\n\tc := cloud.(awsup.AWSCloud)\n\n\ttags := c.Tags()\n\n\tasgs, err := awsup.FindAutoscalingGroups(c, tags)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar resourceTrackers []*resources.Resource\n\n\tfor _, asg := range asgs {\n\t\tresourceTracker := &resources.Resource{","sourceCodeStart":1229,"sourceCodeEnd":1265,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/resources/aws/aws.go#L1229-L1265","documentation":"Thrown when the Auto Scaling DeleteAutoScalingGroup API fails for reasons other than a dependency violation (which is returned unwrapped so callers can retry). Wraps the ASG name and the underlying error during cluster teardown.","triggerScenarios":"DeleteAutoScalingGroup with ForceDelete on an ASG name that doesn't exist (ValidationError: AutoScalingGroup name not found), insufficient iam:DeleteAutoScalingGroup permission, or throttling.","commonSituations":"ASG already deleted by a concurrent/previous run but state cache is stale; IAM role missing autoscaling:DeleteAutoScalingGroup; ASG in a different region than the kops cloud client.","solutions":["Confirm the ASG exists in the correct region: `aws autoscaling describe-auto-scaling-groups --auto-scaling-group-names <id>`.","If it doesn't exist, it's already deleted — re-run kops delete cluster; check for stale state.","Fix IAM permissions (autoscaling:DeleteAutoScalingGroup).","Retry on throttling after backoff."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"groups, err := asgClient.DescribeAutoScalingGroups(ctx, &autoscaling.DescribeAutoScalingGroupsInput{AutoScalingGroupNames: []string{id}}); if err != nil || len(groups.AutoScalingGroups) == 0 { /* already deleted, skip */ }","typeGuard":"func isNotFound(err error) bool { return strings.Contains(err.Error(), \"does not exist\") || strings.Contains(err.Error(), \"not found\") }","tryCatchPattern":"err := DeleteAutoScalingGroup(cloud, r)\nif err != nil {\n\tif isNotFound(err) { return nil } // already deleted\n\treturn err\n}","preventionTips":["Confirm ASG region matches the kops cluster region","Keep autoscaling:DeleteAutoScalingGroup in the IAM policy","Re-run delete; kops treats missing resources as already-deleted on most paths"],"tags":["aws","autoscaling","deletion","api-error"],"backgroundTag":"aws-api-delete-failed","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"}