{"record":{"id":"3b5699417814ee79","repo":"kubernetes/kops","slug":"could-not-find-one-of-launch-configuration-mixed","errorCode":null,"errorMessage":"could not find one of launch configuration, mixed instances policy, or launch template","messagePattern":"could not find one of launch configuration, mixed instances policy, or launch template","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/awstasks/autoscalinggroup.go","lineNumber":1003,"sourceCode":"\t\t\t\t\t\tOnDemandPercentageAboveBaseCapacity: e.MixedOnDemandAboveBase,\n\t\t\t\t\t\tSpotAllocationStrategy:              e.MixedSpotAllocationStrategy,\n\t\t\t\t\t\tSpotInstancePool:                    e.MixedSpotInstancePools,\n\t\t\t\t\t\tSpotMaxPrice:                        e.MixedSpotMaxPrice,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\n\t\tfor _, x := range e.MixedInstanceOverrides {\n\t\t\ttf.MixedInstancesPolicy[0].LaunchTemplate[0].Override = append(tf.MixedInstancesPolicy[0].LaunchTemplate[0].Override, &terraformAutoscalingMixedInstancesPolicyLaunchTemplateOverride{InstanceType: new(x)})\n\t\t}\n\t} else if e.LaunchTemplate != nil {\n\t\ttf.LaunchTemplate = &terraformAutoscalingLaunchTemplateSpecification{\n\t\t\tLaunchTemplateID: e.LaunchTemplate.TerraformLink(),\n\t\t\tVersion:          e.LaunchTemplate.VersionLink(),\n\t\t}\n\t} else {\n\t\treturn fmt.Errorf(\"could not find one of launch configuration, mixed instances policy, or launch template\")\n\t}\n\n\trole := \"\"\n\tfor k := range e.Tags {\n\t\tif strings.HasPrefix(k, CloudTagInstanceGroupRolePrefix) {\n\t\t\tsuffix := strings.TrimPrefix(k, CloudTagInstanceGroupRolePrefix)\n\t\t\tif suffix == \"control-plane\" {\n\t\t\t\tsuffix = \"master\"\n\t\t\t}\n\t\t\tif role != \"\" && role != suffix {\n\t\t\t\treturn fmt.Errorf(\"Found multiple role tags: %q vs %q\", role, suffix)\n\t\t\t}\n\t\t\trole = suffix\n\t\t}\n\t}\n\n\tif e.LaunchTemplate != nil && role != \"\" {\n\t\tfor _, sg := range e.LaunchTemplate.SecurityGroups {","sourceCodeStart":985,"sourceCodeEnd":1021,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/awstasks/autoscalinggroup.go#L985-L1021","documentation":"Raised in the Terraform rendering path for an AutoScalingGroup task: kops requires exactly one launch mechanism (launch configuration, mixed instances policy, or launch template) on the ASG task, and none was set. This is an internal consistency error, not an AWS API error.","triggerScenarios":"TerraformLink/rendering the ASG when e.LaunchConfiguration, e.MixedInstancesPolicy, and e.LaunchTemplate are all nil — e.g. an instance-group produced without a launch template (older spec or a code path that failed to populate the launch template task).","commonSituations":"Hand-edited or partially applied cluster spec where the instanceGroup lost its machine type/launch template wiring; version-skew between kops client and state store produced by a newer kops version; custom controllers calling fi apply with incomplete task graphs.","solutions":["Re-generate the manifests with `kops update cluster` so launch template tasks are created and wired to the ASG.","Upgrade/downgrade to a consistent kops binary version matching the state store, then re-run apply.","Inspect `kops get ig <name> -o yaml` and ensure the instance group has a valid machineType/image so a launch template can be built.","If persistent, restore the cluster spec from backup or recreate the instance group."],"exampleFix":"// before: instance group without image/machineType\nmetadata:\n  name: nodes\nspec: {}\n// after\nmetadata:\n  name: nodes\nspec:\n  machineType: t3.medium\n  image: ubuntu-2204-amd64","handlingStrategy":"validation","validationCode":"// guard before rendering: exactly one launch mechanism must be set\nfunc validateASGLaunch(e *AutoScalingGroup) error {\n  set := 0\n  for _, ok := range []bool{e.LaunchConfiguration != nil, e.MixedInstancesPolicy != nil, e.LaunchTemplate != nil} {\n    if ok { set++ }\n  }\n  if set != 1 { return fmt.Errorf(\"need exactly one of launchConfiguration/mixedInstancesPolicy/launchTemplate, got %d\", set) }\n  return nil\n}","typeGuard":"func hasLaunchMechanism(e *AutoScalingGroup) bool {\n  return e.LaunchConfiguration != nil || e.MixedInstancesPolicy != nil || e.LaunchTemplate != nil\n}","tryCatchPattern":"if err := runTerraformRender(); err != nil {\n  if strings.Contains(err.Error(), \"could not find one of launch configuration\") {\n    return fmt.Errorf(\"instanceGroup spec incomplete - regenerate with `kops update cluster`: %w\", err)\n  }\n  return err\n}","preventionTips":["Always define machineType/image on instance groups.","Use the same kops binary version as the state store.","Regenerate manifests with kops update cluster after upgrading kops."],"tags":["kops","terraform","autoscaling","configuration"],"backgroundTag":"missing-required-argument","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}