{"record":{"id":"727fa518318d557b","repo":"kubernetes/kops","slug":"error-listing-elbs-v","errorCode":null,"errorMessage":"error listing elbs: %v","messagePattern":"error listing elbs: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/resources/aws/aws.go","lineNumber":1579,"sourceCode":"func DescribeELBs(cloud fi.Cloud) ([]elbtypes.LoadBalancerDescription, map[string][]elbtypes.Tag, error) {\n\tctx := context.TODO()\n\tc := cloud.(awsup.AWSCloud)\n\ttags := c.Tags()\n\n\tklog.V(2).Infof(\"Listing all ELBs\")\n\n\trequest := &elb.DescribeLoadBalancersInput{}\n\t// ELB DescribeTags has a limit of 20 names, so we set the page size here to 20 also\n\trequest.PageSize = aws.Int32(20)\n\n\tvar elbs []elbtypes.LoadBalancerDescription\n\telbTags := make(map[string][]elbtypes.Tag)\n\n\tpaginator := elb.NewDescribeLoadBalancersPaginator(c.ELB(), request)\n\tfor paginator.HasMorePages() {\n\t\tpage, err := paginator.NextPage(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, nil, fmt.Errorf(\"error listing elbs: %v\", err)\n\t\t}\n\t\tif len(page.LoadBalancerDescriptions) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\ttagRequest := &elb.DescribeTagsInput{}\n\n\t\tnameToELB := make(map[string]elbtypes.LoadBalancerDescription)\n\t\tfor _, elb := range page.LoadBalancerDescriptions {\n\t\t\tname := aws.ToString(elb.LoadBalancerName)\n\t\t\tnameToELB[name] = elb\n\n\t\t\ttagRequest.LoadBalancerNames = append(tagRequest.LoadBalancerNames, aws.ToString(elb.LoadBalancerName))\n\t\t}\n\n\t\ttagResponse, err := c.ELB().DescribeTags(ctx, tagRequest)\n\t\tif err != nil {\n\t\t\t// An ELB may be deleted between DescribeLoadBalancers and DescribeTags;\n\t\t\t// in that case the batched call fails, so fall back to per-ELB lookups.","sourceCodeStart":1561,"sourceCodeEnd":1597,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/resources/aws/aws.go#L1561-L1597","documentation":"DescribeELBs fails while paginating ELB DescribeLoadBalancers; kOps wraps the AWS error as 'error listing elbs'. This is a read/list failure, not a delete failure — listing is used to discover ELBs belonging to the cluster by tags.","triggerScenarios":"DescribeLoadBalancers pagination returns an error: AccessDenied, ThrottlingException, request-limit-exceeded, or network/SDK failure during ListELBs cluster inventory.","commonSituations":"Read-only credentials missing elasticloadbalancing:DescribeLoadBalancers; large accounts hitting API rate limits; transient AWS outages during 'kops delete cluster --dry-run' or toolbox dump.","solutions":["Retry the listing operation; throttling and transient failures typically clear quickly.","Grant IAM permission elasticloadbalancing:DescribeLoadBalancers (and DescribeTags) to the credentials.","Add pagination/backoff or run during off-peak if rate limits are being hit in large accounts.","Check network/proxy connectivity to the ELB regional endpoint.","Check the wrapped AWS error code to distinguish auth vs throttling vs networking."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Pre-flight IAM check via dry listing\n_, err := c.ELB().DescribeLoadBalancers(ctx, &elb.DescribeLoadBalancersInput{PageSize: aws.Int32(1)})\nif err != nil { /* fail fast: DescribeLoadBalancers not permitted or API unreachable */ }","typeGuard":null,"tryCatchPattern":"if err != nil {\n    if awsup.AWSErrorCode(err) == \"ThrottlingException\" {\n        time.Sleep(2 * time.Second); return DescribeELBs(ctx, cloud, vpcID) // retry\n    }\n    return nil, nil, err\n}","preventionTips":["Run a 1-page pre-flight DescribeLoadBalancers to validate creds/region.","Add exponential backoff on pagination errors.","Grant elasticloadbalancing:DescribeLoadBalancers/DescribeTags.","Avoid running many cluster operations concurrently in one account.","Cache ELB listings within a single kOps invocation."],"tags":["aws","elb","listing","api"],"backgroundTag":"aws-api-list-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"}