{"record":{"id":"a1318c6e18fd3586","repo":"kubernetes/kops","slug":"error-from-describeroutetables-v","errorCode":null,"errorMessage":"error from DescribeRouteTables: %v","messagePattern":"error from DescribeRouteTables: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/resources/aws/aws.go","lineNumber":1348,"sourceCode":"\nfunc FindNatGateways(cloud fi.Cloud, routeTables map[string]*resources.Resource, clusterName string) ([]*resources.Resource, error) {\n\tif len(routeTables) == 0 {\n\t\treturn nil, nil\n\t}\n\n\tctx := context.TODO()\n\tc := cloud.(awsup.AWSCloud)\n\n\tnatGatewayIds := sets.NewString()\n\townedNatGatewayIds := sets.NewString()\n\t{\n\t\trequest := &ec2.DescribeRouteTablesInput{}\n\t\tfor _, routeTable := range routeTables {\n\t\t\trequest.RouteTableIds = append(request.RouteTableIds, routeTable.ID)\n\t\t}\n\t\tresponse, err := c.EC2().DescribeRouteTables(ctx, request)\n\t\tif err != nil && awsup.AWSErrorCode(err) != \"InvalidRouteTableID.NotFound\" {\n\t\t\treturn nil, fmt.Errorf(\"error from DescribeRouteTables: %v\", err)\n\t\t}\n\t\tif response != nil {\n\t\t\tfor _, rt := range response.RouteTables {\n\t\t\t\trouteTableID := aws.ToString(rt.RouteTableId)\n\t\t\t\tresource := routeTables[routeTableID]\n\t\t\t\tif resource == nil {\n\t\t\t\t\t// We somehow got a route table that we didn't ask for\n\t\t\t\t\tklog.Warningf(\"unable to find resource for route table %s\", routeTableID)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tshared := resource.Shared\n\t\t\t\tfor _, t := range rt.Tags {\n\t\t\t\t\tk := *t.Key\n\t\t\t\t\t// v := *t.Value\n\t\t\t\t\tif k == \"AssociatedNatgateway\" {\n\t\t\t\t\t\tshared = true\n\t\t\t\t\t}","sourceCodeStart":1330,"sourceCodeEnd":1366,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/resources/aws/aws.go#L1330-L1366","documentation":"Thrown when EC2 DescribeRouteTables fails (for any code other than InvalidRouteTableID.NotFound) while FindNatGateways resolves which route tables point at NAT gateways. The NotFound code is tolerated because the table may already be deleted; all other failures abort resource enumeration.","triggerScenarios":"DescribeRouteTables with a batch of route table IDs fails: one ID invalid in an unexpected way, UnauthorizedOperation, throttling, or AuthFailure.","commonSituations":"Route tables deleted between listing and describing (race during concurrent teardown); IAM missing ec2:DescribeRouteTables; region mismatch.","solutions":["Read the embedded AWS error code and act: UnauthorizedOperation → fix IAM (ec2:DescribeRouteTables).","If a route table vanished concurrently, re-run kops delete cluster --dry-run; the NotFound path is already handled.","Retry on throttling with backoff.","Verify region/credentials if AuthFailure."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"ids := make([]string, 0, len(routeTables)); for _, rt := range routeTables { if strings.HasPrefix(rt.ID, \"rtb-\") { ids = append(ids, rt.ID) } }","typeGuard":"func isNotFoundCode(err error) bool { return awsup.AWSErrorCode(err) == \"InvalidRouteTableID.NotFound\" }","tryCatchPattern":"_, err := FindNatGateways(cloud, vpcID, clusterName)\nif err != nil {\n\tvar ae smithy.APIError\n\tif errors.As(err, &ae) && ae.ErrorCode() == \"InvalidRouteTableID.NotFound\" { return nil }\n\treturn err\n}","preventionTips":["Accept that concurrent teardown races can delete route tables mid-listing — make operations resumable","Keep ec2:DescribeRouteTables in IAM","Re-run kops delete cluster after transient failures"],"tags":["aws","ec2","route-table","nat-gateway","api-error"],"backgroundTag":"aws-ec2-api-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"}