{"record":{"id":"d0e60ff7f5b0b14d","repo":"kubernetes/kops","slug":"spotinst-failed-to-find-elastigroup-s-v","errorCode":null,"errorMessage":"spotinst: failed to find elastigroup %s: %v","messagePattern":"spotinst: failed to find elastigroup (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/spotinsttasks/elastigroup.go","lineNumber":178,"sourceCode":"\tif e.SecurityGroups != nil {\n\t\tfor _, sg := range e.SecurityGroups {\n\t\t\tdeps = append(deps, sg)\n\t\t}\n\t}\n\n\tif e.UserData != nil {\n\t\tdeps = append(deps, fi.FindDependencies(tasks, e.UserData)...)\n\t}\n\n\treturn deps\n}\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)","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/spotinsttasks/elastigroup.go#L160-L196","documentation":"The spotinst elastigroup task's find() lists all Elastigroups via the Spotinst API and wraps any List() failure with the group name being searched. This is an API-level failure (auth, network, account), not 'not found'.","triggerScenarios":"Find/CheckExisting/update call e.find(svc); svc.List(context.Background()) returns an error from the Spotinst API — invalid token, network failure, or Spotinst service error.","commonSituations":"Spotinst API token expired or rotated; missing/incorrect SPOTINST_TOKEN or SPOTINST_ACCOUNT environment credentials; corporate proxy blocking api.spotinst.com; transient Spotinst outage.","solutions":["Verify the Spotinst credentials (token/account id) used by kOps are valid and not expired/rotated.","Test API reachability: curl -H \"Authorization: Bearer $SPOTINST_TOKEN\" https://api.spotinst.io/aws/ec2/group — fix proxy/DNS if it fails.","Confirm the account configured matches the account that owns the cluster's Elastigroups.","Retry the update if the wrapped error indicates a transient Spotinst 5xx."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// preflight: verify Spotinst API access before running update\ntok := os.Getenv(\"SPOTINST_TOKEN\")\nif tok == \"\" {\n    return fmt.Errorf(\"SPOTINST_TOKEN not set\")\n}\nreq, _ := http.NewRequest(\"GET\", \"https://api.spotinst.io/aws/ec2/group\", nil)\nreq.Header.Set(\"Authorization\", \"Bearer \"+tok)\nresp, err := http.DefaultClient.Do(req)\nif err != nil || resp.StatusCode != 200 {\n    return fmt.Errorf(\"Spotinst API unreachable/unauthorized\")\n}","typeGuard":null,"tryCatchPattern":"groups, err := svc.List(context.Background())\nif err != nil {\n    // distinguish auth vs transient before deciding to fail\n    return nil, fmt.Errorf(\"spotinst: failed to find elastigroup %s: %v\", name, err)\n}","preventionTips":["Keep SPOTINST_TOKEN/SPOTINST_ACCOUNT current in CI","Check proxy/firewall access to api.spotinst.com","Retry List on 5xx with backoff"],"tags":["spotinst","aws","api","authentication"],"backgroundTag":"auth-api-error","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"}