kubernetes/kops · error

spotinst: failed to find launch spec %q

Error message

spotinst: failed to find launch spec %q

What it means

The Ocean has launch specs, but none matches this task's Name. find iterates all specs comparing spec.Name() to the kops LaunchSpec name and errors when no match is found. It signals drift between the Spotinst-side launch spec and the kops instance group.

Source

Thrown at upup/pkg/fi/cloudup/spotinsttasks/launch_spec.go:123

	klog.V(4).Infof("Attempting to find LaunchSpec: %q", fi.ValueOf(o.Name))

	specs, err := svc.List(context.Background(), oceanID)
	if err != nil {
		return nil, fmt.Errorf("spotinst: failed to find launch spec %q: %v", fi.ValueOf(o.Name), err)
	}
	if len(specs) == 0 {
		return nil, fmt.Errorf("spotinst: no launch specs associated with ocean %q", oceanID)
	}

	var out *aws.LaunchSpec
	for _, spec := range specs {
		if spec.Name() == fi.ValueOf(o.Name) {
			out = spec.Obj().(*aws.LaunchSpec)
			break
		}
	}
	if out == nil {
		return nil, fmt.Errorf("spotinst: failed to find launch spec %q", fi.ValueOf(o.Name))
	}

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

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

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

	ocean, err := o.Ocean.find(cloud.Spotinst().Ocean())
	if err != nil {
		return nil, err
	}

	spec, err := o.find(cloud.Spotinst().LaunchSpec(), *ocean.ID)
	if err != nil {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Re-run kops update cluster to recreate the missing launch spec
  2. If the instance group was renamed intentionally, delete the old group: kops delete instancegroup <old-name>
  3. Check the Spotinst console for a spec whose name diverges and align naming
Defensive patterns

Strategy: validation

Validate before calling

specs, _ := svc.List(ctx, oceanID)
names := map[string]bool{}
for _, s := range specs {
    names[s.Name()] = true
}
if !names[expectedName] {
    return fmt.Errorf("launch spec %q missing from ocean; run kops update cluster", expectedName)
}

Prevention

When it happens

Trigger: During Find/update, every listed spec's name differs from fi.ValueOf(o.Name) — e.g. the launch spec was renamed or deleted out-of-band.

Common situations: Launch spec deleted manually in Spotinst console; instance group renamed in the cluster spec; specs created by another tool with different naming.

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/ab995e8e5a446b44. Report an issue: GitHub.