kubernetes/kops · error

found multiple VPCs for cluster %q: %v

Error message

found multiple VPCs for cluster %q: %v

What it means

Fires in DescribeVPC when more than one VPC carries the cluster's tags, so discovery cannot determine which single VPC belongs to the cluster. The input at fault is the AWS environment: duplicate or leftover tagged VPCs (e.g. from a partial delete or reused cluster name).

Source

Thrown at pkg/resources/aws/vpc.go:101

			Filters: filters,
		}
		response, err := c.EC2().DescribeVpcs(ctx, request)
		if err != nil {
			return nil, fmt.Errorf("error listing VPCs: %v", err)
		}

		for _, vpc := range response.Vpcs {
			vpcs[aws.ToString(vpc.VpcId)] = &vpc
		}
	}

	switch len(vpcs) {
	case 0:
		return nil, nil
	case 1:
		return vpcs[slices.Collect(maps.Keys(vpcs))[0]], nil
	default:
		return nil, fmt.Errorf("found multiple VPCs for cluster %q: %v", clusterName, slices.Collect(maps.Keys(vpcs)))
	}
}

func ListVPCs(cloud fi.Cloud, clusterName string) ([]*resources.Resource, error) {
	vpc, err := DescribeVPC(cloud, clusterName)
	if err != nil {
		return nil, err
	}

	var resourceTrackers []*resources.Resource
	if vpc != nil {
		vpcID := aws.ToString(vpc.VpcId)

		resourceTracker := &resources.Resource{
			Name:    FindName(vpc.Tags),
			ID:      vpcID,
			Type:    string(ec2types.ResourceTypeVpc),
			Deleter: DeleteVPC,

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Identify and remove the stale/duplicate VPC tagged with the cluster name
  2. Check for a reused cluster name across regions or accounts
  3. Manually tag exactly one VPC with the cluster tag and remove tags from the other
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/resources/aws/vpc.go:101 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/bc23d9d3e083c425. Report an issue: GitHub.