kubernetes/kops · error
error extracting subnets from pages: %v
Error message
error extracting subnets from pages: %v
What it means
After fetching all pages of subnets from Neutron, kOps calls subnets.ExtractSubnets(allPages) to decode the response bodies. If the pages contain unexpected JSON or an API version mismatch, extraction fails and the error is wrapped as "error extracting subnets from pages". This is a response-decoding problem, not a transport problem.
Source
Thrown at upup/pkg/fi/cloudup/openstack/subnet.go:44
"k8s.io/kops/util/pkg/vfs"
)
func (c *openstackCloud) ListSubnets(opt subnets.ListOptsBuilder) ([]subnets.Subnet, error) {
return listSubnets(c, opt)
}
func listSubnets(c OpenstackCloud, opt subnets.ListOptsBuilder) ([]subnets.Subnet, error) {
var s []subnets.Subnet
done, err := vfs.RetryWithBackoff(readBackoff, func() (bool, error) {
allPages, err := subnets.List(c.NetworkingClient(), opt).AllPages(context.TODO())
if err != nil {
return false, fmt.Errorf("error listing subnets: %v", err)
}
r, err := subnets.ExtractSubnets(allPages)
if err != nil {
return false, fmt.Errorf("error extracting subnets from pages: %v", err)
}
s = r
return true, nil
})
if err != nil {
return s, err
} else if done {
return s, nil
} else {
return s, wait.ErrWaitTimeout
}
}
func (c *openstackCloud) GetSubnet(subnetID string) (*subnets.Subnet, error) {
return getSubnet(c, subnetID)
}
func getSubnet(c OpenstackCloud, subnetID string) (*subnets.Subnet, error) {View on GitHub (pinned to 4c8573c808)
Solutions
- Dump the raw Neutron response (`openstack subnet list --debug`) and compare with what the SDK expects
- Pin/upgrade the gophercloud dependency to a version compatible with your OpenStack release
- Bypass any proxy/middleware to confirm it is not rewriting responses
- Retry once Neutron is confirmed healthy; this error inside RetryWithBackoff surfaces only after retries exhaust
Defensive patterns
Strategy: retry
Validate before calling
// Compare SDK-extracted output with CLI to detect format drift
out, _ := exec.Command("openstack", "subnet", "list", "--format", "json").Output()
if len(out) == 0 {
log.Fatal("neutron returned unexpected empty payload")
} Try / catch
subs, err := listSubnets(cloud, opts)
if err != nil && strings.Contains(err.Error(), "extracting subnets from pages") {
// SDK/Neutron version mismatch: pin gophercloud version and retry
return err
} Prevention
- Pin gophercloud SDK versions compatible with your OpenStack release
- Bypass proxies/interceptors for cloud control-plane traffic
- After Neutron upgrades, re-test subnet listing
- Log raw response bodies on extraction failures
When it happens
Trigger: Neutron returns pages in an unexpected format (proxy/intercepting middleware rewriting responses), incompatible gophercloud/openstack SDK vs server API version, or an empty/malformed page body.
Common situations: Corporate proxy or service mesh mangling JSON responses, Neutron microversion incompatibility, or SDK upgrade where ExtractSubnets expectations changed.
Related errors
- error listing subnets in network %q: %v
- error retrieving subnet with id %s: %v
- error extracting networks from pages: %v
- error listing subnets: %v
- error retrieving subnet: %v
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/f2c439b473c91d9f.
Report an issue: GitHub.