kubernetes/kops · error

found multiple instances with instance id: %s

Error message

found multiple instances with instance id: %s

What it means

DescribeInstances returned more than one instance for a single instance ID, which EC2 should never do. This is a defensive consistency guard; hitting it usually indicates a mocking/test harness anomaly or an SDK-level inconsistency rather than real AWS behavior.

Source

Thrown at pkg/nodeidentity/aws/identify.go:177

	return info, nil
}

// getInstance queries EC2 for the instance with the specified ID, returning an error if not found
func (i *nodeIdentifier) getInstance(ctx context.Context, instanceID string) (*ec2types.Instance, error) {
	// Based on node-authorizer code
	resp, err := i.ec2Client.DescribeInstances(ctx, &ec2.DescribeInstancesInput{
		InstanceIds: []string{instanceID},
	})
	if err != nil {
		return nil, fmt.Errorf("error from ec2 DescribeInstances request: %v", err)
	}

	// @check we found some instances
	if len(resp.Reservations) == 0 || len(resp.Reservations[0].Instances) == 0 {
		return nil, fmt.Errorf("missing instance id: %s", instanceID)
	}
	if len(resp.Reservations[0].Instances) > 1 {
		return nil, fmt.Errorf("found multiple instances with instance id: %s", instanceID)
	}

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

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Re-run identification; if persistent, report as an AWS/SDK anomaly
  2. Verify any custom EC2 client/mocks return a single instance per ID
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/nodeidentity/aws/identify.go:177 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/a0d03f5068f5f8aa. Report an issue: GitHub.