kubernetes/kops · error

error deleting autoscaling launch template %q: %v

Error message

error deleting autoscaling launch template %q: %v

What it means

DeleteLaunchTemplate failed during cleanup after the ASG was deleted; the template may already be gone (NotFound) or ec2:DeleteLaunchTemplate permission is missing, and the AWS error is wrapped.

Source

Thrown at upup/pkg/fi/cloudup/awsup/aws_cloud.go:437

			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 LaunchConfig
	if launchTemplate != "" {
		// Delete launchTemplate
		{
			klog.V(2).Infof("Deleting autoscaling launch template %q", launchTemplate)
			req := &ec2.DeleteLaunchTemplateInput{
				LaunchTemplateName: aws.String(launchTemplate),
			}
			_, err := c.EC2().DeleteLaunchTemplate(ctx, req)
			if err != nil {
				return fmt.Errorf("error deleting autoscaling launch template %q: %v", launchTemplate, err)
			}
		}
	} else if template != "" {
		// Delete LaunchConfig
		{
			klog.V(2).Infof("Deleting autoscaling launch configuration %q", template)
			request := &autoscaling.DeleteLaunchConfigurationInput{
				LaunchConfigurationName: aws.String(template),
			}
			_, err := c.Autoscaling().DeleteLaunchConfiguration(ctx, request)
			if err != nil {
				return fmt.Errorf("error deleting autoscaling launch configuration %q: %v", template, err)
			}
		}
	}

	klog.V(8).Infof("deleted aws autoscaling group: %q", name)

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Check ec2:DeleteLaunchTemplate permissions
  2. Manually remove the leftover launch template if the error is NotFound and re-run
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at upup/pkg/fi/cloudup/awsup/aws_cloud.go:437 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/95e65e757f4e9c2a. Report an issue: GitHub.