{"record":{"id":"1154a4c7d0096a98","repo":"kubernetes/kops","slug":"newsubnettaskfromcloud-failed-to-get-network-with","errorCode":null,"errorMessage":"NewSubnetTaskFromCloud: Failed to get network with ID %s: %v","messagePattern":"NewSubnetTaskFromCloud: Failed to get network with ID (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/openstacktasks/subnet.go","lineNumber":61,"sourceCode":"\tvar deps []fi.CloudupTask\n\tfor _, task := range tasks {\n\t\tif _, ok := task.(*Network); ok {\n\t\t\tdeps = append(deps, task)\n\t\t}\n\t}\n\treturn deps\n}\n\nvar _ fi.CompareWithID = (*Subnet)(nil)\n\nfunc (s *Subnet) CompareWithID() *string {\n\treturn s.ID\n}\n\nfunc NewSubnetTaskFromCloud(cloud openstack.OpenstackCloud, lifecycle fi.Lifecycle, subnet *subnets.Subnet, find *Subnet) (*Subnet, error) {\n\tnetwork, err := cloud.GetNetwork(subnet.NetworkID)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"NewSubnetTaskFromCloud: Failed to get network with ID %s: %v\", subnet.NetworkID, err)\n\t}\n\tnetworkTask, err := NewNetworkTaskFromCloud(cloud, lifecycle, network, find.Tag)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating network task from cloud: %v\", err)\n\t}\n\n\tnameservers := make([]*string, len(subnet.DNSNameservers))\n\tfor i, ns := range subnet.DNSNameservers {\n\t\tnameservers[i] = new(ns)\n\t}\n\n\ttag := \"\"\n\tif find != nil && fi.ArrayContains(subnet.Tags, fi.ValueOf(find.Tag)) {\n\t\ttag = fi.ValueOf(find.Tag)\n\t}\n\n\tactual := &Subnet{\n\t\tID:         new(subnet.ID),","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/openstacktasks/subnet.go#L43-L79","documentation":"NewSubnetTaskFromCloud builds a Subnet task from an existing OpenStack subnet and first fetches its parent network via cloud.GetNetwork(subnet.NetworkID). This error means that Neutron API lookup failed, so the subnet's parent network could not be resolved. It is raised during `kops get`/Find reconciliation when listing subnets.","triggerScenarios":"Subnet.Find lists a subnet successfully, then NewSubnetTaskFromCloud calls cloud.GetNetwork(subnet.NetworkID) and Neutron returns an error — typically 404 because the network was deleted after the subnet record (or the ID is stale from another project/region), or an auth/endpoint failure.","commonSituations":"Cluster spec references a network/subnet that was deleted out-of-band in OpenStack; subnet.NetworkID points to a network in a different OpenStack project the credentials can't see; OS_REGION_NAME or project scope changed so the network ID no longer resolves; transient Neutron outage.","solutions":["Verify the network exists and is visible: `openstack network show <NetworkID>` with the same OS_* credentials kOps uses.","If the network was deleted, update the cluster spec's network/subnet IDs (or delete/recreate the cluster's network config).","Re-run with correct project/region scope (check OS_PROJECT_ID / OS_REGION_NAME) if the ID belongs to another project.","If Neutron returned 5xx/timeout, retry after confirming `openstack network list` works."],"exampleFix":"# check the referenced network\n$ openstack network show <subnet.NetworkID>\n# 404 -> fix cluster spec to reference an existing network\nkops edit cluster  # update networkID/subnet ids\nkops update cluster","handlingStrategy":"validation","validationCode":"// Validate the referenced network before reconcile:\nnetwork, err := cloud.GetNetwork(subnet.NetworkID)\nif err != nil {\n\tif _, ok := err.(gophercloud.ErrDefault404); ok {\n\t\treturn fmt.Errorf(\"network %s does not exist (deleted or wrong project/region); fix the cluster spec\", subnet.NetworkID)\n\t}\n\treturn err\n}","typeGuard":"func networkExists(cloud openstack.OpenstackCloud, id string) bool {\n\tn, err := cloud.GetNetwork(id)\n\treturn err == nil && n != nil && n.ID != \"\"\n}","tryCatchPattern":null,"preventionTips":["After any manual Neutron changes, re-verify network/subnet IDs referenced in the cluster spec.","Use the same OS_PROJECT_ID/OS_REGION_NAME scope for kops as for your `openstack` CLI checks.","Never delete the cluster's network while the cluster exists.","Pin OS_* env vars in CI so kops doesn't silently operate against a different project."],"tags":["openstack","neutron","subnet","network"],"backgroundTag":"resource-not-found","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"}