kubernetes/kops · error

error listing Addresses: %v

Error message

error listing Addresses: %v

What it means

Wraps a failure from Compute Addresses().List in listAddresses, which lists regional static IP addresses and filters by cluster name. A List failure aborts resource discovery for teardown. Unlike newer error paths, this uses %v so the original error is not wrapped for errors.As inspection.

Source

Thrown at pkg/resources/gce/gce.go:836

			klog.Infof("Route not found, assuming deleted: %q", t.SelfLink)
			return nil
		}
		return fmt.Errorf("error deleting Route %s: %v", t.SelfLink, err)
	}

	return c.WaitForOp(op)
}

func (d *clusterDiscoveryGCE) listAddresses() ([]*resources.Resource, error) {
	c := d.gceCloud

	var resourceTrackers []*resources.Resource

	ctx := context.Background()

	addrs, err := c.Compute().Addresses().List(ctx, c.Project(), c.Region())
	if err != nil {
		return nil, fmt.Errorf("error listing Addresses: %v", err)
	}

	for _, a := range addrs {
		if !d.matchesClusterName(a.Name) {
			klog.V(8).Infof("Skipping Address with name %q", a.Name)
			continue
		}

		resourceTracker := &resources.Resource{
			Name:    a.Name,
			ID:      a.Name,
			Type:    typeAddress,
			Deleter: deleteAddress,
			Obj:     a,
		}

		klog.V(4).Infof("Found resource: %s", a.SelfLink)
		resourceTrackers = append(resourceTrackers, resourceTracker)

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Verify the cluster's region is valid and matches where addresses were created.
  2. Grant compute.addresses.list (roles/compute.viewer) to the kops credentials.
  3. Retry on 429/5xx; these are transient.
  4. If the region was changed after cluster creation, revert it or list addresses in the original region manually.
  5. Because the error uses %v, check klog output for the raw Google API error string to identify the status.
Defensive patterns

Strategy: validation

Validate before calling

// validate region and list access before discovery
if region == "" || !strings.Contains(region, "-") {
    return fmt.Errorf("invalid region %q in cluster spec", region)
}
if _, err := computeService.Addresses.List(project, region).PageSize(1).Do(); err != nil {
    if gerr, ok := err.(*googleapi.Error); ok && gerr.Code == 403 {
        return fmt.Errorf("missing compute.addresses.list on %s", project)
    }
}

Type guard

func isGCEAPIError(err error) (*googleapi.Error, bool) {
    var gerr *googleapi.Error
    return gerr, errors.As(err, &gerr)
}

Try / catch

if err := deleteCluster(ctx, c); err != nil {
    var gerr *googleapi.Error
    if errors.As(err, &gerr) && (gerr.Code == 429 || gerr.Code >= 500) {
        // transient: retry after backoff
    }
    return err
}

Prevention

When it happens

Trigger: c.Compute().Addresses().List(ctx, project, region) fails with 403 missing compute.addresses.list, 429 quota, 5xx, or an invalid/unsupported region value (e.g. region field empty or mistyped in the cluster spec).

Common situations: Region misconfiguration after editing the cluster spec; IAM changes stripping compute.addresses.list; transient GCP outages; service-project credentials lacking access in shared VPC topologies.

Related errors


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