{"record":{"id":"03cb9491a490ad45","repo":"kubernetes/kops","slug":"failed-to-list-loadbalancers-s","errorCode":null,"errorMessage":"failed to list loadbalancers: %s","messagePattern":"failed to list loadbalancers: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/openstack/loadbalancer.go","lineNumber":274,"sourceCode":"\t}\n\treturn lb, nil\n}\n\n// ListLBs will list load balancers\nfunc (c *openstackCloud) ListLBs(opt loadbalancers.ListOptsBuilder) (lbs []loadbalancers.LoadBalancer, err error) {\n\treturn listLBs(c, opt)\n}\n\nfunc listLBs(c OpenstackCloud, opt loadbalancers.ListOptsBuilder) (lbs []loadbalancers.LoadBalancer, err error) {\n\tif c.LoadBalancerClient() == nil {\n\t\t// skip error because cluster delete will otherwise fail\n\t\treturn lbs, nil\n\t}\n\n\tdone, err := vfs.RetryWithBackoff(readBackoff, func() (bool, error) {\n\t\tallPages, err := loadbalancers.List(c.LoadBalancerClient(), opt).AllPages(context.TODO())\n\t\tif err != nil {\n\t\t\treturn false, fmt.Errorf(\"failed to list loadbalancers: %s\", err)\n\t\t}\n\t\tlbs, err = loadbalancers.ExtractLoadBalancers(allPages)\n\t\tif err != nil {\n\t\t\treturn false, fmt.Errorf(\"failed to extract loadbalancer pages: %s\", err)\n\t\t}\n\t\treturn true, nil\n\t})\n\tif !done {\n\t\tif err == nil {\n\t\t\terr = wait.ErrWaitTimeout\n\t\t}\n\t\treturn lbs, err\n\t}\n\treturn lbs, nil\n}\n\nfunc (c *openstackCloud) GetLBStats(loadbalancerID string) (stats *loadbalancers.Stats, err error) {\n\treturn getLBStats(c, loadbalancerID)","sourceCodeStart":256,"sourceCodeEnd":292,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/openstack/loadbalancer.go#L256-L292","documentation":"Inside ListLB, loadbalancers.List(...).AllPages is executed under vfs.RetryWithBackoff; any pagination/API failure is wrapped as 'failed to list loadbalancers: %s' (extraction failures get a separate message). It means the Octavia list endpoint failed — auth, endpoint, or server error — after retries, not that zero LBs were found.","triggerScenarios":"Listing all loadbalancers in a project (e.g., during reconciliation or garbage collection) when Octavia returns 401/403 (bad token/scoped project), 404 (endpoint missing), pagination failure on very large projects, or transient 429/5xx responses.","commonSituations":"Keystone token expiry or wrong project scope for the LB client; misconfigured load-balancer endpoint in the catalog; projects with thousands of LBs hitting pagination timeouts; Octavia rate limiting under load.","solutions":["Re-authenticate and confirm the token is scoped to the correct project (openstack token issue)","Check the load-balancer endpoint exists and is reachable (openstack endpoint list / curl the octavia URL)","Inspect the wrapped error: 403 → fix RBAC policy; 429 → slow down/increase rate limits","Narrow the ListOpts filters to reduce page size if pagination times out on large projects","Retry during Octavia recovery — readBackoff already retries transient failures"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// ensure a fresh, correctly-scoped token before listing\nif tokenExpired(client.ProviderClient) {\n\tif err := reauthenticate(client.ProviderClient, authOpts); err != nil {\n\t\treturn fmt.Errorf(\"re-authentication failed before listing loadbalancers: %v\", err)\n\t}\n}","typeGuard":null,"tryCatchPattern":"if _, err := cloud.ListLB(loadbalancers.ListOpts{ProjectID: projectID}); err != nil {\n\tif strings.Contains(err.Error(), \"401\") || strings.Contains(err.Error(), \"Unauthorized\") {\n\t\t// token scoping/expiry issue: re-auth and retry once\n\t\treauthenticate(client.ProviderClient, authOpts)\n\t} else if strings.Contains(err.Error(), \"429\") {\n\t\t// rate limited: back off longer before next attempt\n\t\ttime.Sleep(rateLimitBackoff)\n\t} else {\n\t\tlog.Warningf(\"failed to list loadbalancers: %s\", err)\n\t}\n}","preventionTips":["Keep tokens fresh and scoped to the correct project for the LB client","Verify the load-balancer endpoint in the Keystone catalog periodically","Apply bounded ListOpts filters to avoid pagination timeouts on large projects","Respect 429 rate limits with longer backoff than readBackoff default"],"tags":["openstack","octavia","loadbalancer","api-error","pagination"],"backgroundTag":"resource-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"}