{"record":{"id":"774ee4f7ce5cdc74","repo":"kubernetes/kops","slug":"error-updating-autoscalinggroup-v","errorCode":null,"errorMessage":"error updating AutoscalingGroup: %v","messagePattern":"error updating AutoscalingGroup: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/awstasks/autoscalinggroup.go","lineNumber":661,"sourceCode":"\t\tif changes.InstanceProtection != nil {\n\t\t\trequest.NewInstancesProtectedFromScaleIn = e.InstanceProtection\n\t\t\tchanges.InstanceProtection = nil\n\t\t}\n\n\t\tif changes.CapacityRebalance != nil {\n\t\t\trequest.CapacityRebalance = e.CapacityRebalance\n\t\t\tchanges.CapacityRebalance = nil\n\t\t}\n\n\t\tempty := &AutoscalingGroup{}\n\t\tif !reflect.DeepEqual(empty, changes) {\n\t\t\tklog.Warningf(\"cannot apply changes to AutoScalingGroup: %v\", changes)\n\t\t}\n\n\t\tklog.V(2).Infof(\"Updating autoscaling group %s\", fi.ValueOf(e.Name))\n\n\t\tif _, err := t.Cloud.Autoscaling().UpdateAutoScalingGroup(ctx, request); err != nil {\n\t\t\treturn fmt.Errorf(\"error updating AutoscalingGroup: %v\", err)\n\t\t}\n\n\t\tif deleteTagsRequest != nil && len(deleteTagsRequest.Tags) > 0 {\n\t\t\tif _, err := t.Cloud.Autoscaling().DeleteTags(ctx, deleteTagsRequest); err != nil {\n\t\t\t\treturn fmt.Errorf(\"error deleting old AutoscalingGroup tags: %v\", err)\n\t\t\t}\n\t\t}\n\t\tif updateTagsRequest != nil {\n\t\t\tif _, err := t.Cloud.Autoscaling().CreateOrUpdateTags(ctx, updateTagsRequest); err != nil {\n\t\t\t\treturn fmt.Errorf(\"error updating AutoscalingGroup tags: %v\", err)\n\t\t\t}\n\t\t}\n\n\t\tif detachLBRequest != nil {\n\t\t\tif _, err := t.Cloud.Autoscaling().DetachLoadBalancers(ctx, detachLBRequest); err != nil {\n\t\t\t\treturn fmt.Errorf(\"error detatching LoadBalancers: %v\", err)\n\t\t\t}\n\t\t}","sourceCodeStart":643,"sourceCodeEnd":679,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/awstasks/autoscalinggroup.go#L643-L679","documentation":"kops wraps the AWS AutoScaling UpdateAutoScalingGroup API error when applying changes to an existing ASG during cluster reconciliation in RenderAWS. The underlying AWS error (message included via %v) indicates why the update call was rejected, e.g. invalid configuration or a resource that no longer exists.","triggerScenarios":"Calling fi apply/`kops update cluster --yes` while an AutoScalingGroup task renders an update and the AWS SDK call UpdateAutoScalingGroup fails: ASG name not found (deleted out-of-band), invalid MinSize/MaxSize combination, invalid launch template version, or throttling/IAM permission failure.","commonSituations":"ASG was manually deleted in the AWS console while kops still tracks it; instance group spec produces maxSize < minSize; launch template version referenced was deleted; IAM role lacks autoscaling:UpdateAutoScalingGroup; AWS API throttling during large cluster updates.","solutions":["Read the wrapped AWS error message: if the ASG is not found, re-run `kops update cluster` to recreate it or delete the stale instance group.","Fix MinSize/MaxSize/desired capacity in the InstanceGroup spec so maxSize >= minSize and re-apply.","Verify the launch template/mixed instances policy referenced still exists and its version is valid.","Check IAM permissions of the credentials kops uses (autoscaling:UpdateAutoScalingGroup) and retry after a short delay if throttled."],"exampleFix":"// before: maxSize reduced below minSize in ig spec\nspec:\n  minSize: 3\n  maxSize: 2\n// after\nspec:\n  minSize: 3\n  maxSize: 5","handlingStrategy":"retry","validationCode":"// before apply: sanity-check ASG spec\nif ig.Spec.MaxSize < ig.Spec.MinSize {\n  return fmt.Errorf(\"instanceGroup %s: maxSize (%d) < minSize (%d)\", ig.Name, ig.Spec.MaxSize, ig.Spec.MinSize)\n}\n// confirm ASG exists\n_, err := svc.DescribeAutoScalingGroups(&autoscaling.DescribeAutoScalingGroupsInput{\n  AutoScalingGroupNames: []string{asgName},\n})","typeGuard":null,"tryCatchPattern":"if err := apply(); err != nil {\n  var ae smithy.APIError\n  if errors.As(err, &ae) && isThrottlingCode(ae.ErrorCode()) {\n    backoffAndRetry()\n  } else {\n    log.Fatalf(\"error updating AutoscalingGroup: %v\", err)\n  }\n}","preventionTips":["Never edit ASGs directly in the AWS console; always change via kops specs.","Keep IAM policies for kops complete (autoscaling:UpdateAutoScalingGroup, Describe*).","Validate min/max sizes in CI before apply."],"tags":["aws","autoscaling","cloud-api","kops"],"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"}