{"record":{"id":"6a6f9f949e067bb6","repo":"kubernetes/kops","slug":"spotinst-failed-to-create-elastigroup-v","errorCode":null,"errorMessage":"spotinst: failed to create elastigroup: %v","messagePattern":"spotinst: failed to create elastigroup: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/spotinsttasks/elastigroup.go","lineNumber":791,"sourceCode":"\t\t_, err = cloud.Spotinst().Elastigroup().Create(context.Background(), eg)\n\t\tif err == nil {\n\t\t\tbreak\n\t\t}\n\n\t\tif errs, ok := err.(client.Errors); ok {\n\t\t\tfor _, err := range errs {\n\t\t\t\tif strings.Contains(err.Message, \"Invalid IAM Instance Profile name\") {\n\t\t\t\t\tif attempt > maxAttempts {\n\t\t\t\t\t\treturn fmt.Errorf(\"IAM instance profile not yet created/propagated (original error: %v)\", err)\n\t\t\t\t\t}\n\n\t\t\t\t\tklog.V(4).Infof(\"Got an error indicating that the IAM instance profile %q is not ready %q\", fi.ValueOf(e.IAMInstanceProfile.Name), err)\n\t\t\t\t\tklog.Infof(\"Waiting for IAM instance profile %q to be ready\", fi.ValueOf(e.IAMInstanceProfile.Name))\n\t\t\t\t\tgoto readyLoop\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn fmt.Errorf(\"spotinst: failed to create elastigroup: %v\", err)\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (_ *Elastigroup) update(cloud awsup.AWSCloud, a, e, changes *Elastigroup) error {\n\tklog.V(2).Infof(\"Updating Elastigroup %q\", *e.Name)\n\n\tactual, err := e.find(cloud.Spotinst().Elastigroup())\n\tif err != nil {\n\t\tklog.Errorf(\"Unable to resolve Elastigroup %q, error: %v\", *e.Name, err)\n\t\treturn err\n\t}\n\n\tvar changed bool\n\tgroup := new(aws.Group)\n\tgroup.SetId(actual.ID)","sourceCodeStart":773,"sourceCodeEnd":809,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/spotinsttasks/elastigroup.go#L773-L809","documentation":"create() wraps any Spotinst Create API error that is not the retryable IAM-instance-profile case (or that failed client.Errors type assertion) with this message. It means Elastigroup creation was rejected or failed at the Spotinst API level.","triggerScenarios":"createOrUpdate takes the create path (no existing group found) and cloud.Spotinst().Elastigroup().Create(context.Background(), eg) fails; the error is either not a client.Errors slice or none of the messages contained \"Invalid IAM Instance Profile name\".","commonSituations":"Invalid Elastigroup parameters (bad AMI, invalid subnet/instance type, image not found); Spotinst token/account misconfiguration; Spotinst rejecting the strategy or load-balancer config; quota limits on the Spotinst account.","solutions":["Read the wrapped %v detail — it names the exact Spotinst validation failure (e.g. invalid image, subnet, or load balancer).","Verify Spotinst credentials/account are valid and that the target AWS account/region is connected in Spotinst.","Cross-check the spec values the error implicates (image, subnets, instance types, load balancer name) against real AWS resources.","If related to a missing image, fix resolveImage input; if IAM related, see the instance-profile propagation handling and retry."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// pre-validate the inputs Spotinst will reject\nif err := validateSubnetsExist(cloud, e.Subnets); err != nil {\n    return err\n}\nif e.Image != nil {\n    if _, err := resolveImage(cloud, fi.ValueOf(e.Image)); err != nil {\n        return err // fail fast with the image error, not a generic create failure\n    }\n}","typeGuard":null,"tryCatchPattern":"err := cloud.Spotinst().Elastigroup().Create(ctx, eg)\nif err != nil {\n    if errs, ok := err.(client.Errors); ok {\n        for _, ce := range errs {\n            if strings.Contains(ce.Message, \"Invalid IAM Instance Profile name\") {\n                // handled by the IAM propagation retry path\n                continue\n            }\n        }\n    }\n    return fmt.Errorf(\"spotinst: failed to create elastigroup: %v\", err)\n}","preventionTips":["Validate AMI, subnets, and instance types against the target region before applying","Ensure Spotinst account is connected to the right AWS account/region","Keep Spotinst tokens valid in automation","Read the wrapped Spotinst message — it names the offending field"],"tags":["spotinst","aws","api","create"],"backgroundTag":"cloud-api-create-failed","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"}