{"record":{"id":"c6f2f55b0788b77c","repo":"kubernetes/kops","slug":"error-listing-elb-tags-v","errorCode":null,"errorMessage":"error listing elb Tags: %v","messagePattern":"error listing elb Tags: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/resources/aws/aws.go","lineNumber":1599,"sourceCode":"\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.\n\t\t\tif awsup.AWSErrorCode(err) != \"LoadBalancerNotFound\" {\n\t\t\t\treturn nil, nil, fmt.Errorf(\"error listing elb Tags: %v\", err)\n\t\t\t}\n\t\t\ttagResponse = &elb.DescribeTagsOutput{}\n\t\t\tfor _, name := range tagRequest.LoadBalancerNames {\n\t\t\t\tresp, err := c.ELB().DescribeTags(ctx, &elb.DescribeTagsInput{\n\t\t\t\t\tLoadBalancerNames: []string{name},\n\t\t\t\t})\n\t\t\t\tif err != nil {\n\t\t\t\t\tif awsup.AWSErrorCode(err) == \"LoadBalancerNotFound\" {\n\t\t\t\t\t\tklog.V(2).Infof(\"ELB %q was deleted before tags could be listed\", name)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\treturn nil, nil, fmt.Errorf(\"error listing elb Tags: %v\", err)\n\t\t\t\t}\n\t\t\t\ttagResponse.TagDescriptions = append(tagResponse.TagDescriptions, resp.TagDescriptions...)\n\t\t\t}\n\t\t}\n\n\t\tfor _, t := range tagResponse.TagDescriptions {","sourceCodeStart":1581,"sourceCodeEnd":1617,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/resources/aws/aws.go#L1581-L1617","documentation":"During DescribeELBs, the batched ELB DescribeTags call failed with an error other than LoadBalancerNotFound. kOps deliberately tolerates LoadBalancerNotFound (ELB deleted between the two calls) and falls back to per-ELB lookups; any other error aborts listing.","triggerScenarios":"DescribeTags on a batch of up to 20 ELB names fails with AccessDenied, ThrottlingException, or a transient 5xx that is not the tolerated LoadBalancerNotFound code.","commonSituations":"IAM policy allows DescribeLoadBalancers but not elasticloadbalancing:DescribeTags; throttling when many ELBs are tagged/queried concurrently; AWS transient errors mid-teardown.","solutions":["Grant elasticloadbalancing:DescribeTags in the IAM policy for the credentials.","Retry the listing; the error is usually transient (throttling/5xx).","Confirm the region is correct — DescribeTags against the wrong region fails consistently.","If it reproduces only for specific ELBs, use the per-ELB fallback path kOps already implements to identify the culprit.","Check the wrapped AWS error code for the precise cause."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// Permission pre-flight\n_, err := c.ELB().DescribeTags(ctx, &elb.DescribeTagsInput{LoadBalancerNames: []string{someELB}})\nif err != nil && awsup.AWSErrorCode(err) == \"AccessDenied\" { /* fix IAM before batch work */ }","typeGuard":"func isELBGone(err error) bool { return awsup.AWSErrorCode(err) == \"LoadBalancerNotFound\" }","tryCatchPattern":"tagResp, err := c.ELB().DescribeTags(ctx, tagRequest)\nif err != nil {\n    if isELBGone(err) { /* fall back to per-ELB lookups */ }\n    else if isThrottle(err) { backoff-and-retry }\n    else { return err }\n}","preventionTips":["Ensure elasticloadbalancing:DescribeTags is granted alongside DescribeLoadBalancers.","Keep batch sizes within the 20-name DescribeTags limit.","Treat LoadBalancerNotFound as benign and fall back per-ELB (as kOps does).","Add throttling backoff around tag enumeration.","Re-check the ELB exists between listing and tagging."],"tags":["aws","elb","tags","listing"],"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"}