kubernetes/kops · error
error deleting autoscaling group %q: %v
Error message
error deleting autoscaling group %q: %v
What it means
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.
Source
Thrown at pkg/resources/aws/aws.go:1247
func DeleteAutoScalingGroup(cloud fi.Cloud, r *resources.Resource) error {
ctx := context.TODO()
c := cloud.(awsup.AWSCloud)
id := r.ID
klog.V(2).Infof("Deleting autoscaling group %q", id)
request := &autoscaling.DeleteAutoScalingGroupInput{
AutoScalingGroupName: &id,
ForceDelete: aws.Bool(true),
}
_, err := c.Autoscaling().DeleteAutoScalingGroup(ctx, request)
if err != nil {
if IsDependencyViolation(err) {
return err
}
return fmt.Errorf("error deleting autoscaling group %q: %v", id, err)
}
return nil
}
func ListAutoScalingGroups(cloud fi.Cloud, vpcID, clusterName string) ([]*resources.Resource, error) {
c := cloud.(awsup.AWSCloud)
tags := c.Tags()
asgs, err := awsup.FindAutoscalingGroups(c, tags)
if err != nil {
return nil, err
}
var resourceTrackers []*resources.Resource
for _, asg := range asgs {
resourceTracker := &resources.Resource{View on GitHub (pinned to 4c8573c808)
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.
Defensive patterns
Strategy: type-guard
Validate before calling
groups, err := asgClient.DescribeAutoScalingGroups(ctx, &autoscaling.DescribeAutoScalingGroupsInput{AutoScalingGroupNames: []string{id}}); if err != nil || len(groups.AutoScalingGroups) == 0 { /* already deleted, skip */ } Type guard
func isNotFound(err error) bool { return strings.Contains(err.Error(), "does not exist") || strings.Contains(err.Error(), "not found") } Try / catch
err := DeleteAutoScalingGroup(cloud, r)
if err != nil {
if isNotFound(err) { return nil } // already deleted
return err
} Prevention
- 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
When it happens
Trigger: DeleteAutoScalingGroup with ForceDelete on an ASG name that doesn't exist (ValidationError: AutoScalingGroup name not found), insufficient iam:DeleteAutoScalingGroup permission, or throttling.
Common situations: 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.
Related errors
- error terminating instances: %v
- error deleting ec2 LaunchTemplate %q: %v
- error listing AutoScalingGroups: %v
- error creating AutoScalingGroup: %s
- failed to detach target groups from autoscaling group: %v
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/e13cda6996b25dab.
Report an issue: GitHub.