{"record":{"id":"dc337be2b71e6999","repo":"kubernetes/kops","slug":"spotinst-failed-to-find-elastigroup-q","errorCode":null,"errorMessage":"spotinst: failed to find elastigroup %q","messagePattern":"spotinst: failed to find elastigroup %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/spotinsttasks/elastigroup.go","lineNumber":189,"sourceCode":"}\n\nfunc (e *Elastigroup) find(svc spotinst.InstanceGroupService) (*aws.Group, error) {\n\tklog.V(4).Infof(\"Attempting to find Elastigroup: %q\", fi.ValueOf(e.Name))\n\n\tgroups, err := svc.List(context.Background())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"spotinst: failed to find elastigroup %s: %v\", fi.ValueOf(e.Name), err)\n\t}\n\n\tvar out *aws.Group\n\tfor _, group := range groups {\n\t\tif group.Name() == fi.ValueOf(e.Name) {\n\t\t\tout = group.Obj().(*aws.Group)\n\t\t\tbreak\n\t\t}\n\t}\n\tif out == nil {\n\t\treturn nil, fmt.Errorf(\"spotinst: failed to find elastigroup %q\", fi.ValueOf(e.Name))\n\t}\n\n\tklog.V(4).Infof(\"Elastigroup/%s: %s\", fi.ValueOf(e.Name), stringutil.Stringify(out))\n\treturn out, nil\n}\n\nvar _ fi.CloudupHasCheckExisting = (*Elastigroup)(nil)\n\nfunc (e *Elastigroup) Find(c *fi.CloudupContext) (*Elastigroup, error) {\n\tcloud := awsup.GetCloud(c)\n\n\tgroup, err := e.find(cloud.Spotinst().Elastigroup())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tactual := &Elastigroup{}\n\tactual.Name = group.Name","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/spotinsttasks/elastigroup.go#L171-L207","documentation":"After listing all Elastigroups, find() returns this error if no group's name matches the task's expected name. Unlike 3392 this is a successful API call with zero matches — the Elastigroup does not exist (or has a different name) in the Spotinst account.","triggerScenarios":"Find/CheckExisting/update call find() during reconciliation; svc.List succeeds but no returned group has Name() == fi.ValueOf(e.Name), so out stays nil.","commonSituations":"Elastigroup was deleted manually from the Spotinst console while kOps state still references it; cluster/cluster-name changed so the generated group name no longer matches; looking in the wrong Spotinst account or region; CheckExisting running before the group was ever created.","solutions":["List Elastigroups in the Spotinst console/API and compare names against the one in the error; fix a renamed/deleted group or update the expected name.","Verify kOps targets the correct Spotinst account (SPOTINST_ACCOUNT).","If the group was deleted intentionally, remove the corresponding instance group from the cluster spec (`kops delete instancegroup`).","If it should exist but is missing, run `kops update cluster` so createOrUpdate recreates it (create path, not update)."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// confirm the group exists before assuming update semantics\nexisting, err := e.find(svc)\nif err != nil || existing == nil {\n    // fall through to the create path instead of failing\n    return e.create(cloud, svc)\n}","typeGuard":null,"tryCatchPattern":"out, err := e.find(svc)\nif err != nil {\n    if strings.Contains(err.Error(), \"failed to find elastigroup\") {\n        return e.create(cloud, svc) // treat as not-found, create it\n    }\n    return err\n}","preventionTips":["Don't delete Elastigroups manually from the Spotinst console","Keep instance-group names stable in the cluster spec","Confirm the right Spotinst account before reconciling","Use kops delete instancegroup instead of console deletion"],"tags":["spotinst","aws","not-found","reconciliation"],"backgroundTag":"resource-not-found","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"}