{"record":{"id":"312a129b3840a187","repo":"kubernetes/kops","slug":"error-listing-servers-v-v","errorCode":null,"errorMessage":"error listing servers %v: %v","messagePattern":"error listing servers (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/openstack/instance.go","lineNumber":352,"sourceCode":"\t\treturn server, err\n\t} else if done {\n\t\treturn server, nil\n\t} else {\n\t\treturn server, wait.ErrWaitTimeout\n\t}\n}\n\nfunc (c *openstackCloud) ListInstances(opt servers.ListOptsBuilder) ([]servers.Server, error) {\n\treturn listInstances(c, opt)\n}\n\nfunc listInstances(c OpenstackCloud, opt servers.ListOptsBuilder) ([]servers.Server, error) {\n\tvar instances []servers.Server\n\n\tdone, err := vfs.RetryWithBackoff(readBackoff, func() (bool, error) {\n\t\tallPages, err := servers.List(c.ComputeClient(), opt).AllPages(context.TODO())\n\t\tif err != nil {\n\t\t\treturn false, fmt.Errorf(\"error listing servers %v: %v\", opt, err)\n\t\t}\n\n\t\tss, err := servers.ExtractServers(allPages)\n\t\tif err != nil {\n\t\t\treturn false, fmt.Errorf(\"error extracting servers from pages: %v\", err)\n\t\t}\n\t\tinstances = ss\n\t\treturn true, nil\n\t})\n\tif err != nil {\n\t\treturn instances, err\n\t} else if done {\n\t\treturn instances, nil\n\t} else {\n\t\treturn instances, wait.ErrWaitTimeout\n\t}\n}\n","sourceCodeStart":334,"sourceCodeEnd":370,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/openstack/instance.go#L334-L370","documentation":"listInstances wraps any error from the Nova servers.List AllPages call — i.e. the paged query of servers matching the given ListOptsBuilder failed. It is retried via vfs.RetryWithBackoff(readBackoff) and the final error is wrapped with the list options for context.","triggerScenarios":"servers.List(...).AllPages fails: compute API endpoint unreachable, auth/token failure, invalid or unsupported filter fields in the ListOpts (400), or Nova returning 5xx while paging.","commonSituations":"Invalid tags/name filters in ListOpts that Nova rejects; Keystone credentials expired; OpenStack compute service outage; paginated listing hitting a timeout on very large deployments.","solutions":["Check the wrapped %v error: a 400 usually means an invalid filter in the ListOpts — verify the filter fields are supported by your Nova version","Re-authenticate and confirm the compute endpoint is reachable (`openstack server list` works with the same credentials)","Retry later if it's a 5xx/service outage; the built-in readBackoff already retries transiently","Reduce filter complexity or page size if large listings time out"],"exampleFix":"// before: unsupported filter field\nopt := servers.ListOpts{\"invalid-field\": \"x\"}\n// after: use supported filters, e.g. tags\nopt := servers.ListOpts{\"tags\": kopsTag}","handlingStrategy":"retry","validationCode":"// validate list options before calling\nopts := servers.ListOpts{\"tags\": kopsTag}\nfor k := range opts {\n    if !supportedNovaListFilters[k] { return fmt.Errorf(\"unsupported filter: %s\", k) }\n}","typeGuard":null,"tryCatchPattern":"instances, err := ListInstances(cloud, opts)\nif err != nil && strings.Contains(err.Error(), \"error listing servers\") {\n    // transient API issue — retry read-only list\n    time.Sleep(5 * time.Second)\n    instances, err = ListInstances(cloud, opts)\n}","preventionTips":["Only use Nova-supported filter fields in servers.ListOpts","Verify `openstack server list` works with the same credentials before automation","Handle 5xx from the compute API as transient","Avoid huge unfiltered listings; scope by tag/name"],"tags":["openstack","nova","server-listing","api"],"backgroundTag":"openstack-api-call-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"}