{"record":{"id":"659f3e364f9e93a6","repo":"kubernetes/kops","slug":"expected-a-aws-cloud-provider","errorCode":null,"errorMessage":"expected a aws.Cloud provider","messagePattern":"expected a aws\\.Cloud provider","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/resources/aws/aws.go","lineNumber":1438,"sourceCode":"\n\t\t\t\t\tfor _, eip := range response.Addresses {\n\t\t\t\t\t\teipTracker := buildElasticIPResource(eip, !ownedNatGatewayIds.Has(natGatewayId), clusterName)\n\t\t\t\t\t\tresourceTrackers = append(resourceTrackers, eipTracker)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn resourceTrackers, nil\n}\n\n// DeleteAutoScalingGroupLaunchTemplate deletes\nfunc DeleteAutoScalingGroupLaunchTemplate(cloud fi.Cloud, r *resources.Resource) error {\n\tctx := context.TODO()\n\tc, ok := cloud.(awsup.AWSCloud)\n\tif !ok {\n\t\treturn errors.New(\"expected a aws.Cloud provider\")\n\t}\n\tklog.V(2).Infof(\"Deleting EC2 LaunchTemplate %q\", r.ID)\n\n\tif _, err := c.EC2().DeleteLaunchTemplate(ctx, &ec2.DeleteLaunchTemplateInput{\n\t\tLaunchTemplateId: new(r.ID),\n\t}); err != nil {\n\t\treturn fmt.Errorf(\"error deleting ec2 LaunchTemplate %q: %v\", r.ID, err)\n\t}\n\n\treturn nil\n}\n\nfunc DeleteELB(cloud fi.Cloud, r *resources.Resource) error {\n\tctx := context.TODO()\n\tc := cloud.(awsup.AWSCloud)\n\n\tid := r.ID\n","sourceCodeStart":1420,"sourceCodeEnd":1456,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/resources/aws/aws.go#L1420-L1456","documentation":"Returned immediately after the launch template specification is resolved: LaunchTemplateId was present as a field but empty (aws.ToString yielded \"\"). kOps needs a concrete ID to describe/compare the template during rolling updates.","triggerScenarios":"The ASG's LaunchTemplateSpecification exists but has an empty/nil LaunchTemplateId — typically a malformed or partially populated MixedInstancesPolicy returned by the API, or an ASG created/updated concurrently.","commonSituations":"Externally managed ASGs with broken mixed-instances policy; race during ASG update where the template spec is mid-mutation; custom tooling writing incomplete ASG definitions.","solutions":["Inspect the ASG's MixedInstancesPolicy with `aws autoscaling describe-auto-scaling-groups` and fix the launch template reference","Re-create the ASG through `kops update cluster` so a valid launch template is attached","Re-run the operation if it was a transient mid-update race"],"exampleFix":"// before\nid := aws.ToString(launchTemplate.LaunchTemplateId)\nif id == \"\" {\n\treturn \"\", fmt.Errorf(\"error finding launch template ID for autoscaling group: %s\", aws.ToString(g.AutoScalingGroupName))\n}\n// after\nif launchTemplate.LaunchTemplateId == nil || aws.ToString(launchTemplate.LaunchTemplateId) == \"\" {\n\treturn \"\", fmt.Errorf(\"ASG %s has a launch template spec with empty LaunchTemplateId\", aws.ToString(g.AutoScalingGroupName))\n}\nid := aws.ToString(launchTemplate.LaunchTemplateId)","handlingStrategy":"type-guard","validationCode":"if g.LaunchTemplate != nil && aws.ToString(g.LaunchTemplate.LaunchTemplateId) == \"\" {\n  return fmt.Errorf(\"ASG %q has empty LaunchTemplateId\", aws.ToString(g.AutoScalingGroupName))\n}","typeGuard":"func hasLaunchTemplateID(g *autoscalingtypes.AutoScalingGroup) bool {\n  lt := g.LaunchTemplate\n  if lt == nil && g.MixedInstancesPolicy != nil && g.MixedInstancesPolicy.LaunchTemplate != nil { lt = g.MixedInstancesPolicy.LaunchTemplate.LaunchTemplateSpecification }\n  return lt != nil && aws.ToString(lt.LaunchTemplateId) != \"\"\n}","tryCatchPattern":"err := op(ctx)\nif strings.Contains(err.Error(), \"error finding launch template ID\") {\n  // re-describe the ASG; a mid-update race often resolves on a fresh read\n  time.Sleep(backoff); retry()\n}","preventionTips":["Do not mutate ASG launch templates during rolling updates","Reject ASGs with incomplete MixedInstancesPolicy at creation time","Serialize ASG updates with kops/IaC tooling","Re-describe the ASG before acting on cached group data"],"tags":["aws","autoscaling","launch-template"],"backgroundTag":"launch-template-resolution-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"}