{"record":{"id":"bedf78c5f1d8ea64","repo":"kubernetes/kops","slug":"error-listing-routetables-v-bedf78","errorCode":null,"errorMessage":"error listing RouteTables: %v","messagePattern":"error listing RouteTables: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/resources/aws/routetable.go","lineNumber":46,"sourceCode":"\t\"k8s.io/kops/pkg/resources\"\n\t\"k8s.io/kops/upup/pkg/fi\"\n\t\"k8s.io/kops/upup/pkg/fi/cloudup/awsup\"\n)\n\n// DescribeRouteTables lists route-tables tagged for the cluster (shared and owned)\nfunc DescribeRouteTables(cloud fi.Cloud, clusterName string) (map[string]ec2types.RouteTable, error) {\n\tctx := context.TODO()\n\tc := cloud.(awsup.AWSCloud)\n\n\trouteTables := make(map[string]ec2types.RouteTable)\n\tklog.V(2).Info(\"Listing EC2 RouteTables\")\n\tfor _, filters := range buildEC2FiltersForCluster(clusterName) {\n\t\trequest := &ec2.DescribeRouteTablesInput{\n\t\t\tFilters: filters,\n\t\t}\n\t\tresponse, err := c.EC2().DescribeRouteTables(ctx, request)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error listing RouteTables: %v\", err)\n\t\t}\n\n\t\tfor _, rt := range response.RouteTables {\n\t\t\trouteTables[aws.ToString(rt.RouteTableId)] = rt\n\t\t}\n\t}\n\n\treturn routeTables, nil\n}\n\nfunc ListRouteTables(cloud fi.Cloud, vpcID, clusterName string) ([]*resources.Resource, error) {\n\trouteTables, err := DescribeRouteTables(cloud, clusterName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar resourceTrackers []*resources.Resource\n","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/resources/aws/routetable.go#L28-L64","documentation":"DescribeRouteTables in pkg/resources/aws/routetable.go calls EC2 DescribeRouteTables once per filter set built by buildEC2FiltersForCluster (owned and shared cluster tags) and wraps any API error with this message. It means the route-table inventory for the cluster failed, typically during `kops delete cluster` discovery.","triggerScenarios":"ec2.DescribeRouteTables returning an error for any of the cluster-tag filter sets: UnauthorizedOperation (no ec2:DescribeRouteTables permission), InvalidFilter errors, throttling (RequestLimitExceeded), InvalidClientTokenId from bad credentials, or connectivity failures.","commonSituations":"Read-only IAM profiles missing ec2:DescribeRouteTables; running kops from a network-isolated host or behind a proxy; heavy concurrent deletion hitting EC2 rate limits; wrong-region client (credentials valid elsewhere) causing auth errors.","solutions":["Confirm IAM policy includes ec2:DescribeRouteTables for the account/region.","Check AWS credentials and that the AWSCloud client region matches the cluster's region.","Handle throttling: retry with exponential backoff, or stagger parallel resource listing.","Verify network path to EC2 endpoint (VPC endpoints, proxy, DNS)."],"exampleFix":"// before\nreturn nil, fmt.Errorf(\"error listing RouteTables: %v\", err)\n// after\nvar opErr *smithy.OperationError\nif errors.As(err, &opErr) && strings.Contains(err.Error(), \"RequestLimitExceeded\") {\n    return nil, fmt.Errorf(\"error listing RouteTables (throttled, retry later): %w\", err)\n}\nreturn nil, fmt.Errorf(\"error listing RouteTables: %w\", err)","handlingStrategy":"retry","validationCode":"// preflight: verify describe access\n_, err := ec2Client.DescribeRouteTables(ctx, &ec2.DescribeRouteTablesInput{MaxResults: aws.Int32(1)})\nif err != nil {\n    return fmt.Errorf(\"ec2:DescribeRouteTables preflight failed: %w\", err)\n}","typeGuard":"func isThrottling(err error) bool {\n    return err != nil && (strings.Contains(err.Error(), \"RequestLimitExceeded\") || strings.Contains(err.Error(), \"Throttling\"))\n}","tryCatchPattern":"routeTables, err := DescribeRouteTables(cloud, clusterName)\nif err != nil {\n    if isThrottling(err) {\n        time.Sleep(backoff); routeTables, err = DescribeRouteTables(cloud, clusterName)\n    }\n    if err != nil { return fmt.Errorf(\"route table discovery aborted: %w\", err) }\n}","preventionTips":["Include ec2:DescribeRouteTables in automation IAM policies.","Avoid running many parallel kops deletions against the same account.","Confirm region config matches the cluster before starting deletion.","Test credentials with `aws ec2 describe-route-tables --region <region>` before scripted deletions."],"tags":["aws","ec2","route-tables","iam","throttling"],"backgroundTag":"aws-api-list-call-failed","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"}