{"record":{"id":"8b5604f82aa8636e","repo":"kubernetes/kops","slug":"error-listing-subnets-in-network-q-v","errorCode":null,"errorMessage":"error listing subnets in network %q: %v","messagePattern":"error listing subnets in network %q: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/openstack/cloud.go","lineNumber":585,"sourceCode":"// FindVPCInfo list subnets in network\nfunc (c *openstackCloud) FindVPCInfo(id string) (*fi.VPCInfo, error) {\n\treturn findVPCInfo(c, id, c.zones)\n}\n\nfunc findVPCInfo(c OpenstackCloud, id string, zones []string) (*fi.VPCInfo, error) {\n\tvpcInfo := &fi.VPCInfo{}\n\t// Find subnets in the network\n\t{\n\t\tif len(zones) == 0 {\n\t\t\treturn nil, fmt.Errorf(\"could not initialize zones\")\n\t\t}\n\t\tklog.V(2).Infof(\"Calling ListSubnets for subnets in Network %q\", id)\n\t\topt := subnets.ListOpts{\n\t\t\tNetworkID: id,\n\t\t}\n\t\tsubnets, err := c.ListSubnets(opt)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error listing subnets in network %q: %v\", id, err)\n\t\t}\n\n\t\tfor index, subnet := range subnets {\n\t\t\tzone := zones[int(index)%len(zones)]\n\t\t\tsubnetInfo := &fi.SubnetInfo{\n\t\t\t\tID:   subnet.ID,\n\t\t\t\tCIDR: subnet.CIDR,\n\t\t\t\tZone: zone,\n\t\t\t}\n\t\t\tvpcInfo.Subnets = append(vpcInfo.Subnets, subnetInfo)\n\t\t}\n\t}\n\treturn vpcInfo, nil\n}\n\n// DeleteGroup in openstack will delete servergroup, instances and ports\nfunc (c *openstackCloud) DeleteGroup(g *cloudinstances.CloudInstanceGroup) error {\n\treturn deleteGroup(c, g)","sourceCodeStart":567,"sourceCodeEnd":603,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/openstack/cloud.go#L567-L603","documentation":"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.","triggerScenarios":"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.","commonSituations":"Stale network id passed to FindVPCInfo; project lacks permission to see the network's subnets; transient Neutron outage; wrong OS_* project scope.","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"],"exampleFix":"// before: id from a deleted network\nFindVPCInfo(\"dead-network-id\", zones)\n// after\nFindVPCInfo(\"live-network-id\", zones) // confirmed via 'openstack network show'","handlingStrategy":"validation","validationCode":"// verify network id before listing subnets\nnet, err := neutron.GetNetwork(id)\nif err != nil { return fmt.Errorf(\"network %q not accessible: %w\", id, err) }","typeGuard":null,"tryCatchPattern":"// go\nvpcInfo, err := cloud.FindVPCInfo(id)\nif err != nil && strings.Contains(err.Error(), \"error listing subnets\") {\n    return fmt.Errorf(\"check network id and neutron access: %w\", err)\n}","preventionTips":["Use fresh network IDs (re-fetch after create)","Scope OS_* env to the correct project","Add retry with backoff for transient Neutron errors"],"tags":["openstack","neutron","subnet","api"],"backgroundTag":"openstack-api-list-failed","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}