kubernetes/kops · error

listing ELB LoadBalancers: %w

Error message

listing ELB LoadBalancers: %w

What it means

ListELBV2LoadBalancers pages through DescribeLoadBalancers via the AWS SDK paginator. Any AWS API error during pagination (auth, throttling, network, invalid region/credentials) is wrapped with this message. The wrap preserves the underlying SDK error via %w for errors.Is/As inspection.

Source

Thrown at upup/pkg/fi/cloudup/awsup/elbv2_loadbalancers.go:70

	}
	return "", false
}

func ListELBV2LoadBalancers(ctx context.Context, cloud AWSCloud) ([]*LoadBalancerInfo, error) {
	// TODO: Any way around this?
	klog.V(2).Infof("Listing all NLBs for ListELBV2LoadBalancers")

	request := &elbv2.DescribeLoadBalancersInput{}
	// ELBV2 DescribeTags has a limit of 20 names, so we set the page size here to 20 also
	request.PageSize = aws.Int32(20)

	byARN := make(map[string]*LoadBalancerInfo)

	paginator := elbv2.NewDescribeLoadBalancersPaginator(cloud.ELBV2(), request)
	for paginator.HasMorePages() {
		page, err := paginator.NextPage(ctx)
		if err != nil {
			return nil, fmt.Errorf("listing ELB LoadBalancers: %w", err)
		}
		if len(page.LoadBalancers) == 0 {
			break
		}

		tagRequest := &elbv2.DescribeTagsInput{}

		for _, elb := range page.LoadBalancers {
			arn := aws.ToString(elb.LoadBalancerArn)
			byARN[arn] = &LoadBalancerInfo{LoadBalancer: elb, arn: arn}

			// TODO: Any way to filter by cluster here?

			tagRequest.ResourceArns = append(tagRequest.ResourceArns, aws.ToString(elb.LoadBalancerArn))
		}

		tagResponse, err := cloud.ELBV2().DescribeTags(ctx, tagRequest)
		if err != nil {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Read the wrapped cause (%w) with errors.Is/As to identify the actual SDK error (auth, throttle, network).
  2. Refresh AWS credentials (aws sso login / new session token) and verify the region configuration.
  3. Ensure IAM policy grants elasticloadbalancing:DescribeLoadBalancers and elasticloadbalancing:DescribeTags.
  4. Retry on throttling errors with backoff; reduce concurrent listing frequency.
Defensive patterns

Strategy: retry

Validate before calling

// preflight: verify credentials and region
sess := session.Must(session.NewSession())
_, err := sts.New(sess).GetCallerIdentity(&sts.GetCallerIdentityInput{})

Try / catch

lbs, err := cloud.ListELBV2LoadBalancers()
var awsErr awserr.Error
if errors.As(err, &awsErr) {
	if awsErr.Code() == "Throttling" {
		// retry with backoff
	}
}

Prevention

When it happens

Trigger: ELBV2 DescribeLoadBalancers API call fails: expired/missing AWS credentials, throttling (ThrottlingException), network timeouts, wrong region endpoint, or API disabled in the partition.

Common situations: Running kOps with stale AWS session tokens; IAM user lacking elasticloadbalancing:DescribeLoadBalancers permission; rate limiting during large-scale reconciles; transient network outages in CI.

Related errors


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/2105666f6d9cb599. Report an issue: GitHub.