kubernetes/kops · error

error listing AutoScalingGroups: %v

Error message

error listing AutoScalingGroups: %v

What it means

Wraps any failure from the AWS DescribeAutoScalingGroups paginated API while kOps looks up an existing AutoScalingGroup by tag during task verification. It is a pass-through wrapper: the underlying AWS SDK error (auth, throttling, invalid region, network) is embedded via %v.

Source

Thrown at upup/pkg/fi/cloudup/awstasks/autoscalinggroup.go:299

	if g.NewInstancesProtectedFromScaleIn != nil {
		actual.InstanceProtection = g.NewInstancesProtectedFromScaleIn
	}

	return actual, nil
}

// findAutoscalingGroup is responsible for finding all the autoscaling groups for us
func findAutoscalingGroup(ctx context.Context, cloud awsup.AWSCloud, name string) (*autoscalingtypes.AutoScalingGroup, error) {
	request := &autoscaling.DescribeAutoScalingGroupsInput{
		AutoScalingGroupNames: []string{name},
	}

	var found []*autoscalingtypes.AutoScalingGroup
	paginator := autoscaling.NewDescribeAutoScalingGroupsPaginator(cloud.Autoscaling(), request)
	for paginator.HasMorePages() {
		page, err := paginator.NextPage(ctx)
		if err != nil {
			return nil, fmt.Errorf("error listing AutoScalingGroups: %v", err)
		}
		for _, g := range page.AutoScalingGroups {
			// Check for "Delete in progress" (the only use .Status). We won't be able to update or create while
			// this is true, but filtering it out here makes the messages slightly clearer.
			if g.Status != nil {
				klog.Warningf("Skipping AutoScalingGroup %v: %v", fi.ValueOf(g.AutoScalingGroupName), fi.ValueOf(g.Status))
				continue
			}

			if aws.ToString(g.AutoScalingGroupName) == name {
				found = append(found, &g)
			} else {
				klog.Warningf("Got ASG with unexpected name %q", fi.ValueOf(g.AutoScalingGroupName))
			}
		}
	}

	switch len(found) {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Run `aws autoscaling describe-auto-scaling-groups` with the same credentials/region to reproduce the underlying error
  2. Refresh credentials (aws sso login / re-export keys) and re-run kops apply
  3. Check region configuration on the cluster matches where the ASGs live
  4. Retry later if the message indicates throttling; add retries or reduce concurrency

Example fix

// before (diagnosing)
return nil, fmt.Errorf("error listing AutoScalingGroups: %v", err)
// after (unwrap code for retry logic)
return nil, fmt.Errorf("error listing AutoScalingGroups: %w (code=%s)", err, awsup.AWSErrorCode(err))
Defensive patterns

Strategy: try-catch

Validate before calling

aws sts get-caller-identity && aws autoscaling describe-auto-scaling-groups --region <region> --max-items 1

Type guard

null

Try / catch

try {
  kops update cluster --name mycluster --yes
} catch (e) {
  if (/error listing AutoScalingGroups/.test(e.message)) {
    // inspect wrapped cause: credentials/region/throttling, refresh creds and retry
  }
}

Prevention

When it happens

Trigger: DescribeAutoScalingGroupsPaginator.NextPage returns an error during Find — e.g. expired/invalid AWS credentials, throttling (RequestLimitExceeded), wrong region, or network failure while filtering groups by the kops cluster tag.

Common situations: `kops update cluster` or `kops apply` running with stale credentials, VPC endpoints blocking autoscaling API, or rate limits hit when a cluster has many ASGs and the paginator makes many calls.

Related errors


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