kubernetes/kops · error

error describing targetgroup %s: %w

Error message

error describing targetgroup %s: %w

What it means

DescribeTargetGroups errored while fetching the target group by ARN; TargetGroupNotFoundException is handled separately (returning nil for non-shared groups), so this wrapped error is another AWS failure (permissions, throttling).

Source

Thrown at upup/pkg/fi/cloudup/awstasks/targetgroup.go:185

	return latest, nil
}

func (e *TargetGroup) findTargetGroupByARN(ctx context.Context, cloud awsup.AWSCloud) (*awsup.TargetGroupInfo, error) {
	request := &elbv2.DescribeTargetGroupsInput{}
	request.TargetGroupArns = []string{aws.ToString(e.ARN)}

	var targetGroups []elbv2types.TargetGroup
	paginator := elbv2.NewDescribeTargetGroupsPaginator(cloud.ELBV2(), request)
	for paginator.HasMorePages() {
		page, err := paginator.NextPage(ctx)
		if err != nil {
			var nfe *elbv2types.TargetGroupNotFoundException
			if errors.As(err, &nfe) {
				if !fi.ValueOf(e.Shared) {
					return nil, nil
				}
			}
			return nil, fmt.Errorf("error describing targetgroup %s: %w", *e.ARN, err)
		}
		targetGroups = append(targetGroups, page.TargetGroups...)
	}
	if len(targetGroups) > 1 {
		return nil, fmt.Errorf("found %d TargetGroups with ID %q, expected 1", len(targetGroups), fi.ValueOf(e.Name))
	} else if len(targetGroups) == 0 {
		return nil, nil
	}
	tg := targetGroups[0]

	tagResponse, err := cloud.ELBV2().DescribeTags(ctx, &elbv2.DescribeTagsInput{
		ResourceArns: []string{aws.ToString(tg.TargetGroupArn)},
	})
	if err != nil {
		return nil, err
	}

	info := &awsup.TargetGroupInfo{

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Check elasticloadbalancing:DescribeTargetGroups permissions
  2. Retry the apply for transient API errors
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at upup/pkg/fi/cloudup/awstasks/targetgroup.go:185 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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