kubernetes/kops · error
listing ELB TargetGroups: %w
Error message
listing ELB TargetGroups: %w
What it means
ListELBV2TargetGroups pages through DescribeTargetGroups using the AWS SDK paginator. Any error from the paginated API call is wrapped with this message, keeping the underlying SDK error for errors.Is/As inspection. It occurs before per-target-group tag fetching.
Source
Thrown at upup/pkg/fi/cloudup/awsup/elbv2_targetgroups.go:66
}
}
return "", false
}
func ListELBV2TargetGroups(ctx context.Context, cloud AWSCloud) ([]*TargetGroupInfo, error) {
klog.V(2).Infof("Listing all target groups")
request := &elbv2.DescribeTargetGroupsInput{}
// 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]*TargetGroupInfo)
paginator := elbv2.NewDescribeTargetGroupsPaginator(cloud.ELBV2(), request)
for paginator.HasMorePages() {
page, err := paginator.NextPage(ctx)
if err != nil {
return nil, fmt.Errorf("listing ELB TargetGroups: %w", err)
}
if len(page.TargetGroups) == 0 {
break
}
tagRequest := &elbv2.DescribeTagsInput{}
for _, tg := range page.TargetGroups {
arn := aws.ToString(tg.TargetGroupArn)
byARN[arn] = &TargetGroupInfo{TargetGroup: tg, ARN: arn}
tagRequest.ResourceArns = append(tagRequest.ResourceArns, aws.ToString(tg.TargetGroupArn))
}
tagResponse, err := cloud.ELBV2().DescribeTags(ctx, tagRequest)
if err != nil {
return nil, fmt.Errorf("listing ELB TargetGroup tags: %w", err)
}View on GitHub (pinned to 4c8573c808)
Solutions
- Unwrap the error with errors.Is/As to see the real SDK cause.
- Verify AWS credentials and that the configured region matches the cluster's region.
- Add retry/backoff for ThrottlingException and reduce concurrent listing.
- Confirm IAM permissions include elasticloadbalancing:DescribeTargetGroups.
Defensive patterns
Strategy: retry
Validate before calling
// preflight permission check via IAM policy simulator or dry-run call
_, err := elbv2Client.DescribeTargetGroups(ctx, &elbv2.DescribeTargetGroupsInput{PageSize: aws.Int32(1)}) Try / catch
tgs, err := cloud.ListELBV2TargetGroups()
if err != nil {
var ae smithy.APIError
if errors.As(err, &ae) && (ae.ErrorCode() == "Throttling" || ae.ErrorCode() == "RequestLimitExceeded") {
// exponential backoff retry
}
return err
} Prevention
- Verify credentials/region before running kOps operations
- Grant elasticloadbalancing:DescribeTargetGroups in IAM
- Serialize or rate-limit concurrent reconciles that list target groups
When it happens
Trigger: DescribeTargetGroups API fails: bad/missing credentials, throttling, invalid region, network failure, or (when a name filter is used by findLatestTargetGroupByName) no/invalid parameters.
Common situations: Expired AWS sessions in long-running CI jobs; regional endpoint misconfiguration (e.g. cluster spec region mismatch); throttling when many reconciles list target groups concurrently.
Related errors
- creating NLB target group: %w
- error deleting TargetGroup %q: %v
- target group not yet created (arn not set)
- modifying NLB target group health check: %w
- error deleting ELB TargetGroup %q: %w
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/8d138078e10ceebc.
Report an issue: GitHub.