kubernetes/kops · error

error finding launch template by ID: %q

Error message

error finding launch template by ID: %q

What it means

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.

Source

Thrown at upup/pkg/fi/cloudup/awsup/aws_cloud.go:955

	id := aws.ToString(launchTemplate.LaunchTemplateId)
	if id == "" {
		return "", fmt.Errorf("error finding launch template ID for autoscaling group: %s", aws.ToString(g.AutoScalingGroupName))
	}

	version := aws.ToString(launchTemplate.Version)
	// Correctly Handle Default and Latest Versions
	klog.V(4).Infof("Launch Template Version Specified By ASG: %v", version)
	if version == "" || version == "$Default" || version == "$Latest" {
		input := &ec2.DescribeLaunchTemplatesInput{
			LaunchTemplateIds: []string{id},
		}
		output, err := c.EC2().DescribeLaunchTemplates(ctx, input)
		if err != nil {
			return "", fmt.Errorf("error describing launch templates: %q", err)
		}
		if len(output.LaunchTemplates) == 0 {
			return "", fmt.Errorf("error finding launch template by ID: %q", id)
		}
		launchTemplate := output.LaunchTemplates[0]
		if version == "$Latest" {
			version = strconv.FormatInt(*launchTemplate.LatestVersionNumber, 10)
		} else {
			version = strconv.FormatInt(*launchTemplate.DefaultVersionNumber, 10)
		}
	}
	klog.V(4).Infof("Launch Template Version used for compare: %q", version)

	return fmt.Sprintf("%s:%s", id, version), nil
}

// findInstanceLaunchConfiguration is responsible for discoverying the launch configuration for an instance
func findInstanceLaunchConfiguration(i autoscalingtypes.Instance) string {
	name := aws.ToString(i.LaunchConfigurationName)
	if name != "" {
		return name

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Check the wrapped error for InvalidLaunchTemplateId.NotFound and recreate the launch template if it was deleted
  2. Verify ec2:DescribeLaunchTemplates permission
  3. Retry the read-only kops operation after transient AWS errors clear
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at upup/pkg/fi/cloudup/awsup/aws_cloud.go:955 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/d8392999d7a19cfd. Report an issue: GitHub.