kubernetes/kops · error

found multiple Instances for %q

Error message

found multiple Instances for %q

What it means

kOps expects DescribeInstances for a single instance ID to return exactly one instance. If the reservation contains more than one instance, this error is returned because the API contract (one instance per ID lookup) is violated.

Source

Thrown at upup/pkg/fi/cloudup/awsup/aws_cloud.go:1653

	response, err := c.EC2().DescribeInstances(ctx, request)
	if err != nil {
		return nil, fmt.Errorf("error listing Instances: %v", err)
	}
	if response == nil || len(response.Reservations) == 0 {
		return nil, nil
	}
	if len(response.Reservations) != 1 {
		klog.Fatalf("found multiple Reservations for %q", instanceID)
	}

	reservation := response.Reservations[0]
	if len(reservation.Instances) == 0 {
		return nil, nil
	}

	if len(reservation.Instances) != 1 {
		return nil, fmt.Errorf("found multiple Instances for %q", instanceID)
	}

	instance := reservation.Instances[0]
	return &instance, nil
}

// DescribeVPC is a helper that queries for the specified vpc by id
func (c *awsCloudImplementation) DescribeVPC(vpcID string) (*ec2types.Vpc, error) {
	return describeVPC(c, vpcID)
}

func describeVPC(c AWSCloud, vpcID string) (*ec2types.Vpc, error) {
	klog.V(2).Infof("Calling DescribeVPC for VPC %q", vpcID)
	ctx := context.TODO()
	request := &ec2.DescribeVpcsInput{
		VpcIds: []string{vpcID},
	}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Retry the operation; a transient anomaly usually resolves.
  2. Upgrade kops and the AWS SDK to current versions to pick up deserialization fixes.
  3. Run `aws ec2 describe-instances --instance-ids <id>` to check what AWS actually returns.
  4. If reproducible, file a kOps issue with the instance ID and region.
Defensive patterns

Strategy: fallback

Validate before calling

// Sanity-check via direct AWS call before trusting kops' single-instance invariant
out, _ := ec2Client.DescribeInstances(ctx, &ec2.DescribeInstancesInput{InstanceIds: []string{instanceID}})
// inspect len(out.Reservations[0].Instances) yourself

Try / catch

inst, err := c.DescribeInstance(instanceID)
if err != nil && strings.HasPrefix(err.Error(), "found multiple Instances") {
    // log and fall back to full describe + manual selection
    return nil, fmt.Errorf("ambiguous describe response for %s: %w", instanceID, err)
}

Prevention

When it happens

Trigger: Extremely rare AWS-side anomaly or a kOps bug where the response for a single-instance describe contains multiple instances in reservation.Instances.

Common situations: Corrupted API responses, client/deserializer issues with a particular AWS SDK version, or passing a non-specific query path that returned a reservation with multiple instances.

Related errors


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