kubernetes/kops · error

found multiple RouteTables matching ID

Error message

found multiple RouteTables matching ID

What it means

After DescribeRouteTables by exact ID, kOps expects AWS to return at most one table. Getting more than one for a single ID is an invariant violation, so findRouteTableByID aborts rather than guessing which table to use.

Source

Thrown at upup/pkg/fi/cloudup/awstasks/routetable.go:126

	actual.Shared = e.Shared

	return actual, nil
}

func findRouteTableByID(ctx context.Context, cloud awsup.AWSCloud, id string) (*ec2types.RouteTable, error) {
	request := &ec2.DescribeRouteTablesInput{}
	request.RouteTableIds = []string{id}

	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 ID")
	}
	rt := response.RouteTables[0]

	return &rt, nil
}

func findRouteTableByFilters(ctx context.Context, cloud awsup.AWSCloud, filters []ec2types.Filter) (*ec2types.RouteTable, error) {
	request := &ec2.DescribeRouteTablesInput{}
	request.Filters = filters

	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
	}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Re-run the operation; if reproducible, capture the DescribeRouteTables response and report to AWS support
  2. Verify no proxy/mock EC2 endpoint is misconfigured (custom EC2 endpoint in env/config)
  3. Check kOps version for known bugs and upgrade
Defensive patterns

Strategy: try-catch

Try / catch

rt, err := findRouteTableByID(ctx, cloud, id)
if err != nil && strings.Contains(err.Error(), "found multiple RouteTables matching ID") {
  return fmt.Errorf("AWS returned inconsistent data for %s; retry or investigate", id)
}

Prevention

When it happens

Trigger: DescribeRouteTables returns len(RouteTables) > 1 for a single RouteTableIds lookup — effectively only possible from an AWS API anomaly or a mocked/stubbed client returning multiple entries.

Common situations: Rarely hit in practice; mostly seen in unit tests with fake EC2 clients, or AWS API misbehavior. Real clusters almost never trigger it.

Related errors


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