{"record":{"id":"335d8ec43504c6ad","repo":"kubernetes/kops","slug":"error-building-user-data-v","errorCode":null,"errorMessage":"error building user data: %v","messagePattern":"error building user data: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/model/awsmodel/spotinst.go","lineNumber":317,"sourceCode":"\t\treturn fmt.Errorf(\"error building security groups: %v\", err)\n\t}\n\n\t// SSH key.\n\tgroup.SSHKey, err = b.LinkToSSHKey()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error building ssh key: %v\", err)\n\t}\n\n\t// Load balancers.\n\tgroup.LoadBalancers, group.TargetGroups, err = b.buildLoadBalancers(c, ig)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error building load balancers: %v\", err)\n\t}\n\n\t// User data.\n\tgroup.UserData, err = b.BootstrapScriptBuilder.ResourceNodeUp(c, ig)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error building user data: %v\", err)\n\t}\n\n\t// Public IP.\n\tgroup.AssociatePublicIPAddress, err = b.buildPublicIPOpts(ig)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error building public ip options: %v\", err)\n\t}\n\n\t// Subnets.\n\tgroup.Subnets, err = b.buildSubnets(ig)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error building subnets: %v\", err)\n\t}\n\n\t// Capacity.\n\tgroup.MinSize, group.MaxSize = b.buildCapacity(ig)\n\n\t// Monitoring.","sourceCodeStart":299,"sourceCodeEnd":335,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/model/awsmodel/spotinst.go#L299-L335","documentation":"buildElastigroup generates node bootstrap user data by delegating to b.BootstrapScriptBuilder.ResourceNodeUp(c, ig). This wrapper fires when rendering the nodeup bootstrap script fails, so the Elastigroup task cannot be completed during `kops update cluster`.","triggerScenarios":"`kops update cluster` with Spotinst where the nodeup bootstrap template rendering fails — typically missing/invalid assets in the asset store, an unsupported image/instance-type combination that the template cannot resolve, or an internal template execution error.","commonSituations":"Custom/unsupported AMIs whose architecture the nodeup script cannot infer; corrupted local asset cache (~/.cache/kops); kOps version skew where the template expects assets not present for the selected kubernetes version.","solutions":["Read the wrapped inner error; it names the failed template or asset.","Clear the kops asset cache (rm -rf ~/.cache/kops) and retry `kops update cluster`.","Ensure ig.spec.image matches a supported AMI for the region and the cluster's Kubernetes version.","Upgrade or downgrade kOps to a release matching your cluster's Kubernetes version and retry."],"exampleFix":"// before (cluster.yaml)\nimage: ami-custom-unsupported\n// after\nimage: ami-0abcdef1234567890 # supported Ubuntu/Debian AMI for the region","handlingStrategy":"retry","validationCode":"// ensure a supported image and matching kubernetesVersion\nif ig.Spec.Image == \"\" {\n  return fmt.Errorf(\"instance group %s must set spec.image\", ig.Name)\n}","typeGuard":null,"tryCatchPattern":"if err := kopsUpdate(); err != nil {\n  if strings.Contains(err.Error(), \"error building user data\") {\n    os.RemoveAll(filepath.Join(home, \".cache\", \"kops\")) // clear asset cache\n    // retry update\n  }\n}","preventionTips":["Use AMIs supported for your kOps/Kubernetes versions.","Keep kOps and cluster kubernetesVersion in the same minor-version skew window.","Clear ~/.cache/kops when upgrading kOps.","Avoid untested custom AMIs on Spotinst groups."],"tags":["user-data","spotinst","bootstrap"],"backgroundTag":"bootstrap-script-render-failed","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"}