kubernetes/kops · error
error listing subnets in network %q: %v
Error message
error listing subnets in network %q: %v
What it means
Wraps an error from c.ListSubnets when enumerating Neutron subnets belonging to the given network while building VPCInfo. The network id is included so the developer knows which network's subnet listing failed.
Source
Thrown at upup/pkg/fi/cloudup/openstack/cloud.go:585
// FindVPCInfo list subnets in network
func (c *openstackCloud) FindVPCInfo(id string) (*fi.VPCInfo, error) {
return findVPCInfo(c, id, c.zones)
}
func findVPCInfo(c OpenstackCloud, id string, zones []string) (*fi.VPCInfo, error) {
vpcInfo := &fi.VPCInfo{}
// Find subnets in the network
{
if len(zones) == 0 {
return nil, fmt.Errorf("could not initialize zones")
}
klog.V(2).Infof("Calling ListSubnets for subnets in Network %q", id)
opt := subnets.ListOpts{
NetworkID: id,
}
subnets, err := c.ListSubnets(opt)
if err != nil {
return nil, fmt.Errorf("error listing subnets in network %q: %v", id, err)
}
for index, subnet := range subnets {
zone := zones[int(index)%len(zones)]
subnetInfo := &fi.SubnetInfo{
ID: subnet.ID,
CIDR: subnet.CIDR,
Zone: zone,
}
vpcInfo.Subnets = append(vpcInfo.Subnets, subnetInfo)
}
}
return vpcInfo, nil
}
// DeleteGroup in openstack will delete servergroup, instances and ports
func (c *openstackCloud) DeleteGroup(g *cloudinstances.CloudInstanceGroup) error {
return deleteGroup(c, g)View on GitHub (pinned to 4c8573c808)
Solutions
- Verify the network id exists: 'openstack network show <id>'
- Confirm the project can list its subnets ('openstack subnet list --network <id>')
- Re-authenticate / refresh expired tokens and retry
- Check Neutron service health and endpoint reachability
Example fix
// before: id from a deleted network
FindVPCInfo("dead-network-id", zones)
// after
FindVPCInfo("live-network-id", zones) // confirmed via 'openstack network show' Defensive patterns
Strategy: validation
Validate before calling
// verify network id before listing subnets
net, err := neutron.GetNetwork(id)
if err != nil { return fmt.Errorf("network %q not accessible: %w", id, err) } Try / catch
// go
vpcInfo, err := cloud.FindVPCInfo(id)
if err != nil && strings.Contains(err.Error(), "error listing subnets") {
return fmt.Errorf("check network id and neutron access: %w", err)
} Prevention
- Use fresh network IDs (re-fetch after create)
- Scope OS_* env to the correct project
- Add retry with backoff for transient Neutron errors
When it happens
Trigger: subnets.ListOpts{NetworkID:id} query fails: Neutron API error, auth/token expiry, network id nonexistent or not visible to the project, or connectivity issue to the neutron endpoint.
Common situations: Stale network id passed to FindVPCInfo; project lacks permission to see the network's subnets; transient Neutron outage; wrong OS_* project scope.
Related errors
- error describing Network: %v
- could not list ports %v
- error retrieving subnet with id %s: %v
- error listing ports: %v
- error listing subnets: %v
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/8b5604f82aa8636e.
Report an issue: GitHub.