kubernetes/kops · error

instance not found while waiting for instance to be running

Error message

instance not found while waiting for instance to be running

What it means

The polling loop in WaitForInstanceRunning got a successful describe response but no instance: the EC2 instance no longer exists — typically terminated between creation and this check (capacity reclaim, manual deletion, or failed launch).

Source

Thrown at upup/pkg/fi/cloudup/awsup/aws_apitarget.go:130

		if err != nil {
			return fmt.Errorf("error removing tags from ELBV2 %q: %v", ResourceArn, err)
		}
	}

	return nil
}

func (t *AWSAPITarget) WaitForInstanceRunning(instanceID string) error {
	attempt := 0
	for {
		instance, err := t.Cloud.DescribeInstance(instanceID)
		if err != nil {
			return fmt.Errorf("error while waiting for instance to be running: %v", err)
		}

		if instance == nil {
			// TODO: Wait if we _just_ created the instance?
			return fmt.Errorf("instance not found while waiting for instance to be running")
		}

		state := "?"
		if instance.State != nil {
			state = string(instance.State.Name)
		}
		if state == "running" {
			return nil
		}
		klog.Infof("Waiting for instance %q to be running (current state is %q)", instanceID, state)

		time.Sleep(10 * time.Second)
		attempt++
		if attempt > 30 {
			return fmt.Errorf("timeout waiting for instance %q to be running, state was %q", instanceID, state)
		}
	}
}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Check the AWS console for why the instance vanished (terminated, failed status checks)
  2. Re-run `kops update`/apply so a replacement instance is created
  3. Check instance limits and capacity in the availability zone
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at upup/pkg/fi/cloudup/awsup/aws_apitarget.go:130 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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