kubernetes/kops · error
error listing Subnets: %w
Error message
error listing Subnets: %w
What it means
Wrapped error from Subnet.Find when the Subnetworks.Get call (against the project derived from NetworkID, falling back to the cloud project) fails with a non-404 error. Despite the 'listing' wording it is a single-subnet Get; fires on permissions, wrong region/name, or API failures.
Source
Thrown at upup/pkg/fi/cloudup/gcetasks/subnet.go:70
func (e *Subnet) CompareWithID() *string {
return e.Name
}
func (e *Subnet) Find(c *fi.CloudupContext) (*Subnet, error) {
cloud := c.T.Cloud.(gce.GCECloud)
_, project, err := gce.ParseNameAndProjectFromNetworkID(c.T.Cluster.Spec.Networking.NetworkID)
if err != nil {
return nil, fmt.Errorf("error parsing network name from cluster spec: %w", err)
} else if project == "" {
project = cloud.Project()
}
s, err := cloud.Compute().Subnetworks().Get(project, cloud.Region(), *e.Name)
if err != nil {
if gce.IsNotFound(err) {
return nil, nil
}
return nil, fmt.Errorf("error listing Subnets: %w", err)
}
actual := &Subnet{}
actual.Name = &s.Name
actual.Network = &Network{Name: new(lastComponent(s.Network))}
actual.Region = new(lastComponent(s.Region))
actual.CIDR = &s.IpCidrRange
actual.StackType = &s.StackType
actual.Ipv6AccessType = &s.Ipv6AccessType
shared := fi.ValueOf(e.Shared)
{
actual.SecondaryIpRanges = make(map[string]string)
for _, r := range s.SecondaryIpRanges {
if shared {
// In the shared case, only show differences on the ranges we specified
if _, found := e.SecondaryIpRanges[r.RangeName]; !found {
continueView on GitHub (pinned to 4c8573c808)
Solutions
- Inspect the wrapped error for the Google API reason
- Verify the subnet name, region, and the project resolved from NetworkID
- Ensure compute.subnetworks.get permission on that project
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at upup/pkg/fi/cloudup/gcetasks/subnet.go:70 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/5ba21ac69d1d26d5.
Report an issue: GitHub.