{"record":{"id":"f57c62ea933936dc","repo":"kubernetes/kops","slug":"found-multiple-routetables-matching-tags","errorCode":null,"errorMessage":"found multiple RouteTables matching tags","messagePattern":"found multiple RouteTables matching tags","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/awstasks/routetable.go","lineNumber":146,"sourceCode":"\trt := response.RouteTables[0]\n\n\treturn &rt, nil\n}\n\nfunc findRouteTableByFilters(ctx context.Context, cloud awsup.AWSCloud, filters []ec2types.Filter) (*ec2types.RouteTable, error) {\n\trequest := &ec2.DescribeRouteTablesInput{}\n\trequest.Filters = filters\n\n\tresponse, err := cloud.EC2().DescribeRouteTables(ctx, request)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error listing RouteTables: %v\", err)\n\t}\n\tif response == nil || len(response.RouteTables) == 0 {\n\t\treturn nil, nil\n\t}\n\n\tif len(response.RouteTables) != 1 {\n\t\treturn nil, fmt.Errorf(\"found multiple RouteTables matching tags\")\n\t}\n\trt := response.RouteTables[0]\n\treturn &rt, nil\n}\n\nfunc (e *RouteTable) Run(c *fi.CloudupContext) error {\n\treturn fi.CloudupDefaultDeltaRunMethod(e, c)\n}\n\nfunc (s *RouteTable) CheckChanges(a, e, changes *RouteTable) error {\n\tif a == nil {\n\t\tif e.VPC == nil {\n\t\t\treturn fi.RequiredField(\"VPC\")\n\t\t}\n\t}\n\tif a != nil {\n\t\tif changes.VPC != nil && changes.VPC.ID != nil {\n\t\t\treturn fi.CannotChangeField(\"VPC\")","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/awstasks/routetable.go#L128-L164","documentation":"findRouteTableByFilters expects the tag filters (cluster/role tags) to match exactly one route table. Multiple matches mean the tagging scheme is ambiguous — kOps refuses to guess and returns this error.","triggerScenarios":"More than one EC2 route table carries the same kOps tags (e.g. duplicate 'kubernetes.io/cluster/<name>=owned' or role tags), typically because a previous run left orphaned resources or tables were copied/cloned.","commonSituations":"Re-running `kops create cluster` with the same cluster name against an existing VPC; manual table duplication during DR setup; leftover resources from a failed teardown; shared-VPC setups where an old cluster's tables share tags.","solutions":["List tables with matching tags (`aws ec2 describe-route-tables --filters Name=tag:kubernetes.io/cluster/<cluster>,Values=owned`) and delete the duplicates","Run `kops delete cluster` for stale clusters before recreating","Correct tags manually so only one table carries the expected role tags for the subnet","If using a shared VPC, scope tags/cluster names to avoid collisions"],"exampleFix":"// before: two tables tagged kubernetes.io/cluster=mycluster=owned\naws ec2 delete-route-table --route-table-id rtb-duplicate\n// after: exactly one table retains the tags","handlingStrategy":"validation","validationCode":"aws ec2 describe-route-tables --filters Name=tag:kubernetes.io/cluster/mycluster.example.com,Values=owned --query 'length(RouteTables)'\n# must be 1 before running kops update","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Delete orphaned/stale clusters with `kops delete cluster` before recreating with the same name","Never clone route tables while keeping kOps ownership tags","Use unique cluster names in shared VPCs","Audit tags periodically to guarantee one table per (cluster, role) pair"],"tags":["aws","ec2","routetable","tags","ambiguity"],"backgroundTag":"ambiguous-resource-lookup","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}