kubernetes/kops · error

found multiple RouteTables matching tags

Error message

found multiple RouteTables matching tags

What it means

When looking up a route table by ID within RouteTableAssociation.Find, kOps expects exactly one result; more than one is impossible for an ID lookup but treated as an ambiguity and fails fast. (The 'matching tags' wording is inherited from the by-filters helper and is slightly misleading here.)

Source

Thrown at upup/pkg/fi/cloudup/awstasks/routetableassociation.go:71

	if routeTableID == nil || subnetID == nil {
		return nil, nil
	}

	request := &ec2.DescribeRouteTablesInput{
		RouteTableIds: []string{fi.ValueOf(routeTableID)},
	}

	response, err := cloud.EC2().DescribeRouteTables(ctx, request)
	if err != nil {
		return nil, fmt.Errorf("error listing RouteTables: %v", err)
	}
	if response == nil || len(response.RouteTables) == 0 {
		return nil, nil
	}

	if len(response.RouteTables) != 1 {
		return nil, fmt.Errorf("found multiple RouteTables matching tags")
	}
	rt := response.RouteTables[0]
	for _, rta := range rt.Associations {
		if aws.ToString(rta.SubnetId) != *subnetID {
			continue
		}
		actual := &RouteTableAssociation{
			Name:       e.Name,
			ID:         rta.RouteTableAssociationId,
			RouteTable: &RouteTable{ID: rta.RouteTableId},
			Subnet:     &Subnet{ID: rta.SubnetId},
		}
		klog.V(2).Infof("found matching RouteTableAssociation %q", *actual.ID)
		e.ID = actual.ID

		// Prevent spurious changes
		actual.Lifecycle = e.Lifecycle

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Re-run; if persistent, capture the raw DescribeRouteTables response for AWS support
  2. Check for a misconfigured custom EC2 endpoint or mock/proxy in the environment
  3. File/report a kOps issue if reproducible with a real AWS endpoint
Defensive patterns

Strategy: try-catch

Try / catch

rt, err := findRouteTable(ctx, cloud, id, subnetID)
if err != nil && strings.Contains(err.Error(), "found multiple RouteTables") {
  return fmt.Errorf("ambiguous route table data for %s; investigate AWS response", id)
}

Prevention

When it happens

Trigger: len(response.RouteTables) > 1 from an ID-scoped DescribeRouteTables — only via anomalous API behavior or a test/mocked EC2 client returning multiple tables.

Common situations: Unit tests with fake clients; AWS API anomalies. Practically unobservable in real clusters.

Related errors


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