kubernetes/kops · error
error deleting detached instances for autoscaling group %q:
Error message
error deleting detached instances for autoscaling group %q: %v
What it means
TerminateInstances failed while terminating the instances previously detached from the autoscaling group during cluster/IG teardown; the wrapped error is the AWS EC2 API response.
Source
Thrown at upup/pkg/fi/cloudup/awsup/aws_cloud.go:409
template := aws.ToString(asg.LaunchConfigurationName)
launchTemplate := ""
if asg.LaunchTemplate != nil {
launchTemplate = aws.ToString(asg.LaunchTemplate.LaunchTemplateName)
}
// Delete detached instances
{
detached, err := findDetachedInstances(ctx, c, asg)
if err != nil {
return fmt.Errorf("error searching for detached instances for autoscaling group %q: %v", name, err)
}
if len(detached) > 0 {
klog.V(2).Infof("Deleting detached instances for autoscaling group %q", name)
req := &ec2.TerminateInstancesInput{
InstanceIds: detached,
}
if _, err := c.EC2().TerminateInstances(ctx, req); err != nil {
return fmt.Errorf("error deleting detached instances for autoscaling group %q: %v", name, err)
}
}
}
// Delete ASG
{
klog.V(2).Infof("Deleting autoscaling group %q", name)
request := &autoscaling.DeleteAutoScalingGroupInput{
AutoScalingGroupName: aws.String(name),
ForceDelete: aws.Bool(true),
}
_, err := c.Autoscaling().DeleteAutoScalingGroup(ctx, request)
if err != nil {
return fmt.Errorf("error deleting autoscaling group %q: %v", name, err)
}
}
// Delete LaunchConfigView on GitHub (pinned to 4c8573c808)
Solutions
- Check the instances still exist and ec2:TerminateInstances permission is granted
- Retry the delete; instances may have been terminated concurrently
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at upup/pkg/fi/cloudup/awsup/aws_cloud.go:409 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/f6f99f7ed6f467cf.
Report an issue: GitHub.