kubernetes/kops · error

error listing Routers: %w

Error message

error listing Routers: %w

What it means

Wrapped error from Router.Find when the Routers.Get call fails with a non-404 error. The 'listing' wording is misleading — it is a single-router Get during discovery; fires on permissions, wrong region/name, or GCE API failures.

Source

Thrown at upup/pkg/fi/cloudup/gcetasks/router.go:76

}

var _ fi.CompareWithID = (*Router)(nil)

// CompareWithID returns the name of the Router.
func (r *Router) CompareWithID() *string {
	return r.Name
}

// Find discovers the Router in the cloud provider.
func (r *Router) Find(c *fi.CloudupContext) (*Router, error) {
	cloud := c.T.Cloud.(gce.GCECloud)

	found, err := cloud.Compute().Routers().Get(cloud.Project(), *r.Region, *r.Name)
	if err != nil {
		if gce.IsNotFound(err) {
			return nil, nil
		}
		return nil, fmt.Errorf("error listing Routers: %w", err)
	}

	if len(found.Nats) != 1 {
		return nil, fmt.Errorf("unexpected number of nats found: %+v", found.Nats)
	}
	nat := found.Nats[0]

	if a, e := found.SelfLink, r.url(cloud.Project()); a != e {
		klog.Warningf("SelfLink did not match URL: %q vs %q", a, e)
	}

	actual := &Router{
		Name:                          &found.Name,
		Lifecycle:                     r.Lifecycle,
		Network:                       &Network{Name: new(lastComponent(found.Network))},
		Region:                        new(lastComponent(found.Region)),
		NATIPAllocationOption:         &nat.NatIpAllocateOption,
		SourceSubnetworkIPRangesToNAT: &nat.SourceSubnetworkIpRangesToNat,

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Inspect the wrapped error for the Google API reason
  2. Verify the router name and region in the spec
  3. Ensure compute.routers.get permission on the project
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at upup/pkg/fi/cloudup/gcetasks/router.go:76 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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