{"record":{"id":"d8392999d7a19cfd","repo":"kubernetes/kops","slug":"error-finding-launch-template-by-id-q","errorCode":null,"errorMessage":"error finding launch template by ID: %q","messagePattern":"error finding launch template by ID: %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/awsup/aws_cloud.go","lineNumber":955,"sourceCode":"\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\" {\n\t\t\tversion = strconv.FormatInt(*launchTemplate.LatestVersionNumber, 10)\n\t\t} else {\n\t\t\tversion = strconv.FormatInt(*launchTemplate.DefaultVersionNumber, 10)\n\t\t}\n\t}\n\tklog.V(4).Infof(\"Launch Template Version used for compare: %q\", version)\n\n\treturn fmt.Sprintf(\"%s:%s\", id, version), nil\n}\n\n// findInstanceLaunchConfiguration is responsible for discoverying the launch configuration for an instance\nfunc findInstanceLaunchConfiguration(i autoscalingtypes.Instance) string {\n\tname := aws.ToString(i.LaunchConfigurationName)\n\tif name != \"\" {\n\t\treturn name","sourceCodeStart":937,"sourceCodeEnd":973,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/awsup/aws_cloud.go#L937-L973","documentation":"DescribeLaunchTemplates returned an error while looking up the launch template by ID (to resolve its default or latest version); the template ID in %q is the one queried. Fires on API failure, deleted launch template, or permission errors.","triggerScenarios":"Thrown at upup/pkg/fi/cloudup/awsup/aws_cloud.go:955 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the wrapped error for InvalidLaunchTemplateId.NotFound and recreate the launch template if it was deleted","Verify ec2:DescribeLaunchTemplates permission","Retry the read-only kops operation after transient AWS errors clear"],"exampleFix":null,"handlingStrategy":"retry","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"}