kubernetes/kops · error
error listing ports: %v
Error message
error listing ports: %v
What it means
listPorts (upup/pkg/fi/cloudup/openstack/port.go:110) pages through the Neutron port-list API inside a retry loop (readBackoff). If ports.List(...).AllPages fails — the HTTP request itself errors or pagination breaks — the error is wrapped with this message.
Source
Thrown at upup/pkg/fi/cloudup/openstack/port.go:110
return p, err
} else if done {
return p, nil
} else {
return p, wait.ErrWaitTimeout
}
}
func (c *openstackCloud) ListPorts(opt ports.ListOptsBuilder) ([]ports.Port, error) {
return listPorts(c, opt)
}
func listPorts(c OpenstackCloud, opt ports.ListOptsBuilder) ([]ports.Port, error) {
var p []ports.Port
done, err := vfs.RetryWithBackoff(readBackoff, func() (bool, error) {
allPages, err := ports.List(c.NetworkingClient(), opt).AllPages(context.TODO())
if err != nil {
return false, fmt.Errorf("error listing ports: %v", err)
}
r, err := ports.ExtractPorts(allPages)
if err != nil {
return false, fmt.Errorf("error extracting ports from pages: %v", err)
}
p = r
return true, nil
})
if err != nil {
return p, err
} else if done {
return p, nil
} else {
return p, wait.ErrWaitTimeout
}
}
View on GitHub (pinned to 4c8573c808)
Solutions
- Verify OS_* auth variables and that the token is valid (openstack port list works from CLI).
- Check the Neutron endpoint/region configuration matches the target cloud.
- Simplify or correct the ListOptsBuilder filters to ensure they are valid Neutron query parameters.
- Re-run — readBackoff retries transient failures automatically.
Example fix
// before
allPages, err := ports.List(c.NetworkingClient(), opt).AllPages(context.TODO())
if err != nil {
return false, fmt.Errorf("error listing ports: %v", err)
}
// after — bound the call so a hung API cannot block forever
ctx, cancel := context.WithTimeout(context.TODO(), 30*time.Second)
defer cancel()
allPages, err := ports.List(c.NetworkingClient(), opt).AllPages(ctx)
if err != nil {
return false, fmt.Errorf("error listing ports: %v", err)
} Defensive patterns
Strategy: retry
Validate before calling
// Verify credentials and connectivity to Neutron before listing
_, err := c.NetworkingClient().Get("/networks?limit=1")
if err != nil {
return fmt.Errorf("Neutron API not reachable with current credentials: %w", err)
} Try / catch
ports, err := listPorts(c, opts)
if err != nil {
if strings.Contains(err.Error(), "error listing ports") {
// listPorts already retried via readBackoff; log and surface the wrapped cause
return fmt.Errorf("port listing failed after retries: %w", err)
}
return err
} Prevention
- Validate OS_* auth env/credentials periodically; refresh tokens before long operations.
- Confirm the configured region/endpoint points at the correct Neutron service.
- Keep list filters to valid Neutron query parameters.
- Increase backoff windows for large projects where the API is slow.
When it happens
Trigger: ports.List(c.NetworkingClient(), opt).AllPages(context.TODO()) returns an error on every retry: unreachable/incorrect Neutron endpoint, 401/403 auth failure, malformed list filters (e.g. bad network_id or match query), or a dropped connection mid-pagination.
Common situations: Expired or misconfigured OpenStack credentials during cluster operations; wrong region/endpoint configured; Neutron API timeout on large projects with many ports; transient network partition between the client and the OpenStack API.
Related errors
- error describing Network: %v
- error listing subnets in network %q: %v
- could not list ports %v
- error extracting ports from pages: %v
- network %q not found
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/95acb6d1ba69055f.
Report an issue: GitHub.