kubernetes/kops · error

error listing RouteTables: %v

Error message

error listing RouteTables: %v

What it means

kOps wraps failures from the EC2 DescribeRouteTables API (called without tag filters, to also find untagged route tables in the VPC). Any API-level failure is wrapped and aborts route table discovery. This is a read-only listing step used by deletion flows to find leftover route tables.

Source

Thrown at pkg/resources/aws/aws.go:925

		if IsDependencyViolation(err) {
			return err
		}
		return fmt.Errorf("error deleting RouteTable %q: %v", id, err)
	}
	return nil
}

// DescribeRouteTablesIgnoreTags returns all ec2.RouteTable, ignoring tags
func DescribeRouteTablesIgnoreTags(cloud fi.Cloud) ([]ec2types.RouteTable, error) {
	ctx := context.TODO()
	c := cloud.(awsup.AWSCloud)

	klog.V(2).Infof("Listing all RouteTables")
	request := &ec2.DescribeRouteTablesInput{}
	response, err := c.EC2().DescribeRouteTables(ctx, request)
	if err != nil {
		return nil, fmt.Errorf("error listing RouteTables: %v", err)
	}

	return response.RouteTables, nil
}

func DeleteDhcpOptions(cloud fi.Cloud, r *resources.Resource) error {
	ctx := context.TODO()
	c := cloud.(awsup.AWSCloud)

	id := r.ID

	klog.V(2).Infof("Deleting EC2 DhcpOptions %q", id)
	request := &ec2.DeleteDhcpOptionsInput{
		DhcpOptionsId: &id,
	}
	_, err := c.EC2().DeleteDhcpOptions(ctx, request)
	if err != nil {
		if awsup.AWSErrorCode(err) == "InvalidDhcpOptionsID.NotFound" {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Validate access with `aws ec2 describe-route-tables --region <region>` using the same credentials
  2. On throttling errors, reduce parallelism or request an EC2 rate-limit increase, then retry
  3. Refresh credentials (re-login / refresh SSO / re-export keys) and re-run
  4. Check network/proxy reachability to ec2.<region>.amazonaws.com
Defensive patterns

Strategy: retry

Validate before calling

// preflight connectivity + auth to EC2
if _, err := sts.New(sess).GetCallerIdentity(&sts.GetCallerIdentityInput{}); err != nil {
	return fmt.Errorf("bad AWS credentials: %w", err)
}
if _, err := ec2cli.DescribeRouteTables(&ec2.DescribeRouteTablesInput{MaxResults: aws.Int64(5)}); err != nil {
	return fmt.Errorf("EC2 describe failed in %s: %w", region, err)
}

Try / catch

var tables []ec2types.RouteTable
err := backoff.Retry(func() error {
	var e error
	tables, e = aws.DescribeRouteTablesIgnoreTags(cloud)
	return e // retry on throttling, permanent on auth
}, backoff.WithMaxRetries(backoff.NewExponentialBackOff(), 5))

Prevention

When it happens

Trigger: EC2 DescribeRouteTables returns an error: expired/invalid credentials, throttling, network failure, or invalid endpoint/region configuration.

Common situations: Long cluster deletions where the AWS session expired mid-run; account-level EC2 rate limiting during parallel kOps operations; corporate proxy blocking EC2 endpoints.

Related errors


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