{"record":{"id":"35811154eeb71915","repo":"kubernetes/kops","slug":"error-finding-launch-template-id-for-autoscaling-g","errorCode":null,"errorMessage":"error finding launch template ID for autoscaling group: %s","messagePattern":"error finding launch template ID for autoscaling group: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/awsup/aws_cloud.go","lineNumber":940,"sourceCode":"func findAutoscalingGroupLaunchConfiguration(ctx context.Context, c AWSCloud, g *autoscalingtypes.AutoScalingGroup) (string, error) {\n\tname := aws.ToString(g.LaunchConfigurationName)\n\tif name != \"\" {\n\t\treturn name, nil\n\t}\n\n\t// @check the launch template then\n\tvar launchTemplate *autoscalingtypes.LaunchTemplateSpecification\n\tif g.LaunchTemplate != nil {\n\t\tlaunchTemplate = g.LaunchTemplate\n\t} else if g.MixedInstancesPolicy != nil && g.MixedInstancesPolicy.LaunchTemplate != nil && g.MixedInstancesPolicy.LaunchTemplate.LaunchTemplateSpecification != nil {\n\t\tlaunchTemplate = g.MixedInstancesPolicy.LaunchTemplate.LaunchTemplateSpecification\n\t} else {\n\t\treturn \"\", fmt.Errorf(\"error finding launch template or configuration for autoscaling group: %s\", aws.ToString(g.AutoScalingGroupName))\n\t}\n\n\tid := aws.ToString(launchTemplate.LaunchTemplateId)\n\tif id == \"\" {\n\t\treturn \"\", fmt.Errorf(\"error finding launch template ID for autoscaling group: %s\", aws.ToString(g.AutoScalingGroupName))\n\t}\n\n\tversion := aws.ToString(launchTemplate.Version)\n\t// Correctly Handle Default and Latest Versions\n\tklog.V(4).Infof(\"Launch Template Version Specified By ASG: %v\", version)\n\tif version == \"\" || version == \"$Default\" || version == \"$Latest\" {\n\t\tinput := &ec2.DescribeLaunchTemplatesInput{\n\t\t\tLaunchTemplateIds: []string{id},\n\t\t}\n\t\toutput, err := c.EC2().DescribeLaunchTemplates(ctx, input)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"error describing launch templates: %q\", err)\n\t\t}\n\t\tif len(output.LaunchTemplates) == 0 {\n\t\t\treturn \"\", fmt.Errorf(\"error finding launch template by ID: %q\", id)\n\t\t}\n\t\tlaunchTemplate := output.LaunchTemplates[0]\n\t\tif version == \"$Latest\" {","sourceCodeStart":922,"sourceCodeEnd":958,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/awsup/aws_cloud.go#L922-L958","documentation":"Guard error: the ASG's LaunchTemplateSpecification exists but its LaunchTemplateId field is empty, so the launch template version cannot be resolved. The ASG named by %s carries a malformed launch template reference.","triggerScenarios":"Thrown at upup/pkg/fi/cloudup/awsup/aws_cloud.go:940 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the named ASG's launch template specification in AWS and fix or reattach the launch template so it carries an ID","Recreate the ASG via kops rolling-update to restore a well-formed launch template reference"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}