kubernetes/kops · error

spotinst: failed to find elastigroup %q

Error message

spotinst: failed to find elastigroup %q

What it means

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.

Source

Thrown at upup/pkg/fi/cloudup/spotinsttasks/elastigroup.go:189

}

func (e *Elastigroup) find(svc spotinst.InstanceGroupService) (*aws.Group, error) {
	klog.V(4).Infof("Attempting to find Elastigroup: %q", fi.ValueOf(e.Name))

	groups, err := svc.List(context.Background())
	if err != nil {
		return nil, fmt.Errorf("spotinst: failed to find elastigroup %s: %v", fi.ValueOf(e.Name), err)
	}

	var out *aws.Group
	for _, group := range groups {
		if group.Name() == fi.ValueOf(e.Name) {
			out = group.Obj().(*aws.Group)
			break
		}
	}
	if out == nil {
		return nil, fmt.Errorf("spotinst: failed to find elastigroup %q", fi.ValueOf(e.Name))
	}

	klog.V(4).Infof("Elastigroup/%s: %s", fi.ValueOf(e.Name), stringutil.Stringify(out))
	return out, nil
}

var _ fi.CloudupHasCheckExisting = (*Elastigroup)(nil)

func (e *Elastigroup) Find(c *fi.CloudupContext) (*Elastigroup, error) {
	cloud := awsup.GetCloud(c)

	group, err := e.find(cloud.Spotinst().Elastigroup())
	if err != nil {
		return nil, err
	}

	actual := &Elastigroup{}
	actual.Name = group.Name

View on GitHub (pinned to 4c8573c808)

Solutions

  1. 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.
  2. Verify kOps targets the correct Spotinst account (SPOTINST_ACCOUNT).
  3. If the group was deleted intentionally, remove the corresponding instance group from the cluster spec (`kops delete instancegroup`).
  4. If it should exist but is missing, run `kops update cluster` so createOrUpdate recreates it (create path, not update).
Defensive patterns

Strategy: fallback

Validate before calling

// confirm the group exists before assuming update semantics
existing, err := e.find(svc)
if err != nil || existing == nil {
    // fall through to the create path instead of failing
    return e.create(cloud, svc)
}

Try / catch

out, err := e.find(svc)
if err != nil {
    if strings.Contains(err.Error(), "failed to find elastigroup") {
        return e.create(cloud, svc) // treat as not-found, create it
    }
    return err
}

Prevention

When it happens

Trigger: Find/CheckExisting/update call find() during reconciliation; svc.List succeeds but no returned group has Name() == fi.ValueOf(e.Name), so out stays nil.

Common situations: 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.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/dc337be2b71e6999. Report an issue: GitHub.