{"record":{"id":"038e616afb7719f9","repo":"kubernetes/kops","slug":"error-listing-elbs-v-038e61","errorCode":null,"errorMessage":"error listing ELBs: %v","messagePattern":"error listing ELBs: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/awstasks/classic_load_balancer.go","lineNumber":75,"sourceCode":"\nfunc findLoadBalancerByLoadBalancerName(ctx context.Context, cloud awsup.AWSCloud, loadBalancerName string) (*elbtypes.LoadBalancerDescription, error) {\n\trequest := &elb.DescribeLoadBalancersInput{\n\t\tLoadBalancerNames: []string{loadBalancerName},\n\t}\n\tfound, err := describeLoadBalancers(ctx, cloud, request, func(lb elbtypes.LoadBalancerDescription) bool {\n\t\tif aws.ToString(lb.LoadBalancerName) == loadBalancerName {\n\t\t\treturn true\n\t\t}\n\n\t\tklog.Warningf(\"Got ELB with unexpected name: %q\", aws.ToString(lb.LoadBalancerName))\n\t\treturn false\n\t})\n\tif err != nil {\n\t\tif awsup.AWSErrorCode(err) == \"LoadBalancerNotFound\" {\n\t\t\treturn nil, nil\n\t\t}\n\n\t\treturn nil, fmt.Errorf(\"error listing ELBs: %v\", err)\n\t}\n\n\tif len(found) == 0 {\n\t\treturn nil, nil\n\t}\n\n\tif len(found) != 1 {\n\t\treturn nil, fmt.Errorf(\"Found multiple ELBs with name %q\", loadBalancerName)\n\t}\n\n\treturn &found[0], nil\n}\n\nfunc describeLoadBalancers(ctx context.Context, cloud awsup.AWSCloud, request *elb.DescribeLoadBalancersInput, filter func(elbtypes.LoadBalancerDescription) bool) ([]elbtypes.LoadBalancerDescription, error) {\n\tvar found []elbtypes.LoadBalancerDescription\n\tpaginator := elb.NewDescribeLoadBalancersPaginator(cloud.ELB(), request)\n\tfor paginator.HasMorePages() {\n\t\toutput, err := paginator.NextPage(ctx)","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/awstasks/classic_load_balancer.go#L57-L93","documentation":"Wraps AWS SDK errors from DescribeLoadBalancers (classic ELB) when kOps searches for an existing Classic Load Balancer by name during Find. The special 'LoadBalancerNotFound' code is treated as not-found (nil, nil); any other failure is wrapped in this error.","triggerScenarios":"The paginated elb DescribeLoadBalancers call fails with an error other than LoadBalancerNotFound: IAM permissions (elasticloadbalancing:DescribeLoadBalancers), throttling, invalid region/endpoint, or network failures.","commonSituations":"IAM policy scoped to only some ELB actions; AWS API throttling on large accounts with many ELBs; wrong region configuration in kOps cluster spec.","solutions":["Inspect the wrapped AWS error message for the root cause","Grant elasticloadbalancing:DescribeLoadBalancers (and DescribeLoadBalancerAttributes/Tags) to the kOps IAM role","Check the cluster region matches where the ELB exists","Retry on throttling errors or add backoff between applies"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"aws elb describe-load-balancers --load-balancer-names $LB_NAME 2>/dev/null || echo 'LB absent; creation path must be NLB'","typeGuard":"function isNotFound(err) { return err && err.code === 'LoadBalancerNotFound'; }","tryCatchPattern":"try {\n  lb = await findLoadBalancerByLoadBalancerName(ctx, cloud, name);\n} catch (err) {\n  if (awsup.AWSErrorCode(err) !== 'LoadBalancerNotFound') throw err; // surfaces wrapped ELB listing error\n}","preventionTips":["Grant elasticloadbalancing:DescribeLoadBalancers to the kOps role","Confirm the cluster region matches the ELB's region","Refresh AWS credentials before long apply runs"],"tags":["aws","elb","classic-load-balancer","api-error"],"backgroundTag":"aws-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"}