{"record":{"id":"7a1cdb73481bcd76","repo":"kubernetes/kops","slug":"error-listing-subnets-v-7a1cdb","errorCode":null,"errorMessage":"error listing subnets: %v","messagePattern":"error listing subnets: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/openstack/subnet.go","lineNumber":39,"sourceCode":"\t\"fmt\"\n\n\t\"github.com/gophercloud/gophercloud/v2/openstack/networking/v2/subnets\"\n\t\"k8s.io/apimachinery/pkg/util/wait\"\n\t\"k8s.io/kops/upup/pkg/fi\"\n\t\"k8s.io/kops/util/pkg/vfs\"\n)\n\nfunc (c *openstackCloud) ListSubnets(opt subnets.ListOptsBuilder) ([]subnets.Subnet, error) {\n\treturn listSubnets(c, opt)\n}\n\nfunc listSubnets(c OpenstackCloud, opt subnets.ListOptsBuilder) ([]subnets.Subnet, error) {\n\tvar s []subnets.Subnet\n\n\tdone, err := vfs.RetryWithBackoff(readBackoff, func() (bool, error) {\n\t\tallPages, err := subnets.List(c.NetworkingClient(), opt).AllPages(context.TODO())\n\t\tif err != nil {\n\t\t\treturn false, fmt.Errorf(\"error listing subnets: %v\", err)\n\t\t}\n\n\t\tr, err := subnets.ExtractSubnets(allPages)\n\t\tif err != nil {\n\t\t\treturn false, fmt.Errorf(\"error extracting subnets from pages: %v\", err)\n\t\t}\n\t\ts = r\n\t\treturn true, nil\n\t})\n\tif err != nil {\n\t\treturn s, err\n\t} else if done {\n\t\treturn s, nil\n\t} else {\n\t\treturn s, wait.ErrWaitTimeout\n\t}\n}\n","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/openstack/subnet.go#L21-L57","documentation":"listSubnets paginates through Neutron subnets via subnets.List(...).AllPages inside a RetryWithBackoff loop. If the Neutron API list call fails, the error is wrapped as \"error listing subnets: %v\". Retries are exhausted before surfacing, so the wrapped error reflects persistent API failure.","triggerScenarios":"Neutron endpoint down/unreachable, auth failure on the networking client, invalid ListOpts filter (e.g. bad network ID or project ID), or quota/RBAC denial on subnet listing.","commonSituations":"Wrong OS_REGION_NAME or endpoint catalog entry, network ID typo in cluster config, Keystone token expired mid-operation, or a policy change restricting subnet reads for the project.","solutions":["Run `openstack subnet list` with the same credentials to reproduce the Neutron failure","Check the wrapped error: 401 => re-authenticate; 403 => fix RBAC policy; timeout => check Neutron service","Validate the network ID / filter options passed in ListOpts","Verify the networking service endpoint in the Keystone catalog"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Pre-flight: confirm neutron is reachable\nif err := exec.Command(\"openstack\", \"subnet\", \"list\", \"--limit\", \"1\").Run(); err != nil {\n\tlog.Fatal(\"Neutron API unavailable\")\n}","typeGuard":null,"tryCatchPattern":"subnets, err := listSubnets(cloud, opts)\nif err != nil {\n\tif strings.Contains(err.Error(), \"401\") {\n\t\t// re-authenticate then retry once\n\t}\n\treturn err\n}","preventionTips":["Validate network/project IDs in ListOpts before calling","Keep Keystone tokens refreshed for long operations","Check Neutron service health in monitoring","Verify RBAC policy allows subnet reads for the project"],"tags":["openstack","neutron","network","subnet"],"backgroundTag":"neutron-api-list-failed","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}