{"record":{"id":"1142ee4597f2c6bf","repo":"kubernetes/kops","slug":"could-not-initialize-zones","errorCode":null,"errorMessage":"could not initialize zones","messagePattern":"could not initialize zones","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/openstack/cloud.go","lineNumber":577,"sourceCode":"func (c *openstackCloud) DNS() (dnsprovider.Interface, error) {\n\tprovider, err := dnsprovider.GetDnsProvider(designate.ProviderName, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error building (Designate) DNS provider: %v\", err)\n\t}\n\treturn provider, nil\n}\n\n// FindVPCInfo list subnets in network\nfunc (c *openstackCloud) FindVPCInfo(id string) (*fi.VPCInfo, error) {\n\treturn findVPCInfo(c, id, c.zones)\n}\n\nfunc findVPCInfo(c OpenstackCloud, id string, zones []string) (*fi.VPCInfo, error) {\n\tvpcInfo := &fi.VPCInfo{}\n\t// Find subnets in the network\n\t{\n\t\tif len(zones) == 0 {\n\t\t\treturn nil, fmt.Errorf(\"could not initialize zones\")\n\t\t}\n\t\tklog.V(2).Infof(\"Calling ListSubnets for subnets in Network %q\", id)\n\t\topt := subnets.ListOpts{\n\t\t\tNetworkID: id,\n\t\t}\n\t\tsubnets, err := c.ListSubnets(opt)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error listing subnets in network %q: %v\", id, err)\n\t\t}\n\n\t\tfor index, subnet := range subnets {\n\t\t\tzone := zones[int(index)%len(zones)]\n\t\t\tsubnetInfo := &fi.SubnetInfo{\n\t\t\t\tID:   subnet.ID,\n\t\t\t\tCIDR: subnet.CIDR,\n\t\t\t\tZone: zone,\n\t\t\t}\n\t\t\tvpcInfo.Subnets = append(vpcInfo.Subnets, subnetInfo)","sourceCodeStart":559,"sourceCodeEnd":595,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/openstack/cloud.go#L559-L595","documentation":"findVPCInfo (backing FindVPCInfo) returns this when the zones slice passed in is empty — kOps cannot map subnets of the network to availability zones, so it refuses to build VPCInfo. It is a pre-condition failure, not an API error.","triggerScenarios":"FindVPCInfo called for a network id with zones == nil/empty, e.g. cluster spec defines no zones or zones were not propagated before the VPC lookup.","commonSituations":"Cluster spec missing topology/zones entries; zones list dropped during spec parsing; caller invoking FindVPCInfo directly in tests/tools without zone data.","solutions":["Define zones in the cluster spec (kops set cluster.spec topology / zones) before update/create","Verify the spec parses zones correctly (kops get cluster -oyaml | grep zones)","If invoking findVPCInfo programmatically, pass a non-empty zones slice"],"exampleFix":"// before\nzones: []\n// after\nzones: [\"nova-1\", \"nova-2\"]","handlingStrategy":"validation","validationCode":"if len(zones) == 0 {\n    return nil, fmt.Errorf(\"zones must be non-empty before FindVPCInfo\")\n}","typeGuard":null,"tryCatchPattern":"// go\nvpcInfo, err := cloud.FindVPCInfo(netID)\nif err != nil && strings.Contains(err.Error(), \"could not initialize zones\") {\n    return fmt.Errorf(\"define zones in the cluster spec: %w\", err)\n}","preventionTips":["Always define topology zones in the cluster spec","Validate the spec with kops before apply","Check zones propagate into cloud discovery calls"],"tags":["openstack","zones","vpc","configuration"],"backgroundTag":"empty-required-input","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"}