{"record":{"id":"362247d2df445c66","repo":"kubernetes/kops","slug":"error-listing-autoscalinggroups-v","errorCode":null,"errorMessage":"error listing AutoScalingGroups: %v","messagePattern":"error listing AutoScalingGroups: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/awstasks/autoscalinggroup.go","lineNumber":299,"sourceCode":"\tif g.NewInstancesProtectedFromScaleIn != nil {\n\t\tactual.InstanceProtection = g.NewInstancesProtectedFromScaleIn\n\t}\n\n\treturn actual, nil\n}\n\n// findAutoscalingGroup is responsible for finding all the autoscaling groups for us\nfunc findAutoscalingGroup(ctx context.Context, cloud awsup.AWSCloud, name string) (*autoscalingtypes.AutoScalingGroup, error) {\n\trequest := &autoscaling.DescribeAutoScalingGroupsInput{\n\t\tAutoScalingGroupNames: []string{name},\n\t}\n\n\tvar found []*autoscalingtypes.AutoScalingGroup\n\tpaginator := autoscaling.NewDescribeAutoScalingGroupsPaginator(cloud.Autoscaling(), request)\n\tfor paginator.HasMorePages() {\n\t\tpage, err := paginator.NextPage(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error listing AutoScalingGroups: %v\", err)\n\t\t}\n\t\tfor _, g := range page.AutoScalingGroups {\n\t\t\t// Check for \"Delete in progress\" (the only use .Status). We won't be able to update or create while\n\t\t\t// this is true, but filtering it out here makes the messages slightly clearer.\n\t\t\tif g.Status != nil {\n\t\t\t\tklog.Warningf(\"Skipping AutoScalingGroup %v: %v\", fi.ValueOf(g.AutoScalingGroupName), fi.ValueOf(g.Status))\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif aws.ToString(g.AutoScalingGroupName) == name {\n\t\t\t\tfound = append(found, &g)\n\t\t\t} else {\n\t\t\t\tklog.Warningf(\"Got ASG with unexpected name %q\", fi.ValueOf(g.AutoScalingGroupName))\n\t\t\t}\n\t\t}\n\t}\n\n\tswitch len(found) {","sourceCodeStart":281,"sourceCodeEnd":317,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/awstasks/autoscalinggroup.go#L281-L317","documentation":"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.","triggerScenarios":"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.","commonSituations":"`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.","solutions":["Run `aws autoscaling describe-auto-scaling-groups` with the same credentials/region to reproduce the underlying error","Refresh credentials (aws sso login / re-export keys) and re-run kops apply","Check region configuration on the cluster matches where the ASGs live","Retry later if the message indicates throttling; add retries or reduce concurrency"],"exampleFix":"// before (diagnosing)\nreturn nil, fmt.Errorf(\"error listing AutoScalingGroups: %v\", err)\n// after (unwrap code for retry logic)\nreturn nil, fmt.Errorf(\"error listing AutoScalingGroups: %w (code=%s)\", err, awsup.AWSErrorCode(err))","handlingStrategy":"try-catch","validationCode":"aws sts get-caller-identity && aws autoscaling describe-auto-scaling-groups --region <region> --max-items 1","typeGuard":"null","tryCatchPattern":"try {\n  kops update cluster --name mycluster --yes\n} catch (e) {\n  if (/error listing AutoScalingGroups/.test(e.message)) {\n    // inspect wrapped cause: credentials/region/throttling, refresh creds and retry\n  }\n}","preventionTips":["Keep AWS credentials fresh (SSO/instance profiles) before long apply runs","Pin the correct region in kops cluster spec and AWS_* env vars","Add exponential backoff for throttling when automating applies"],"tags":["aws","autoscaling","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"}