{"record":{"id":"cdb96ca6105f13c6","repo":"kubernetes/kops","slug":"error-listing-autoscaling-launchtemplates-v","errorCode":null,"errorMessage":"error listing AutoScaling LaunchTemplates: %v","messagePattern":"error listing AutoScaling LaunchTemplates: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/resources/aws/aws.go","lineNumber":1316,"sourceCode":"\tc := cloud.(awsup.AWSCloud)\n\n\tklog.V(2).Infof(\"Finding all AutoScaling LaunchTemplates owned by the cluster\")\n\n\tinput := &ec2.DescribeLaunchTemplatesInput{\n\t\tFilters: []ec2types.Filter{\n\t\t\t{\n\t\t\t\tName:   aws.String(\"tag:kubernetes.io/cluster/\" + clusterName),\n\t\t\t\tValues: []string{\"owned\"},\n\t\t\t},\n\t\t},\n\t}\n\n\tvar list []*resources.Resource\n\tpaginator := ec2.NewDescribeLaunchTemplatesPaginator(c.EC2(), input)\n\tfor paginator.HasMorePages() {\n\t\tpage, err := paginator.NextPage(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error listing AutoScaling LaunchTemplates: %v\", err)\n\t\t}\n\t\tfor _, lt := range page.LaunchTemplates {\n\t\t\tlist = append(list, &resources.Resource{\n\t\t\t\tName:    aws.ToString(lt.LaunchTemplateName),\n\t\t\t\tID:      aws.ToString(lt.LaunchTemplateId),\n\t\t\t\tType:    TypeAutoscalingLaunchConfig,\n\t\t\t\tDeleter: DeleteAutoScalingGroupLaunchTemplate,\n\t\t\t})\n\t\t}\n\t}\n\n\treturn list, nil\n}\n\nfunc FindNatGateways(cloud fi.Cloud, routeTables map[string]*resources.Resource, clusterName string) ([]*resources.Resource, error) {\n\tif len(routeTables) == 0 {\n\t\treturn nil, nil\n\t}","sourceCodeStart":1298,"sourceCodeEnd":1334,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/resources/aws/aws.go#L1298-L1334","documentation":"Thrown when a paginated EC2 DescribeLaunchTemplates call (DescribeLaunchTemplatesPaginator) fails while discovering launch templates used by AutoScaling groups in the cluster VPC. Any page failure aborts the whole listing with this wrapped error.","triggerScenarios":"DescribeLaunchTemplates pagination returns UnauthorizedOperation, ThrottlingException, AuthFailure, or InvalidFilter on any page.","commonSituations":"IAM policy lacking ec2:DescribeLaunchTemplates; API rate limiting during large cluster enumeration; expired session token mid-scan.","solutions":["Run `aws ec2 describe-launch-templates` to reproduce the underlying error.","Grant ec2:DescribeLaunchTemplates in IAM.","Retry after throttling backoff; consider reducing parallel kops operations.","Refresh credentials if AuthFailure/ExpiredToken."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"_, err := ec2Client.DescribeLaunchTemplates(ctx, &ec2.DescribeLaunchTemplatesInput{MaxResults: aws.Int32(1)}); if err != nil { /* resolve IAM/creds before full listing */ }","typeGuard":"func isThrottling(err error) bool { var ae smithy.APIError; return errors.As(err, &ae) && (ae.ErrorCode() == \"ThrottlingException\" || ae.ErrorCode() == \"RequestLimitExceeded\") }","tryCatchPattern":"lts, err := FindAutoScalingLaunchTemplates(cloud, vpcID, clusterName)\nif err != nil {\n\tif isThrottling(err) { time.Sleep(backoff); lts, err = FindAutoScalingLaunchTemplates(...) }\n\tif err != nil { return err }\n}","preventionTips":["Grant ec2:DescribeLaunchTemplates in IAM","Avoid running many concurrent kops list/delete operations on one account","Refresh session tokens before long-running enumerations"],"tags":["aws","ec2","launch-template","pagination","api-error"],"backgroundTag":"aws-ec2-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"}