{"record":{"id":"677e30c667247367","repo":"kubernetes/kops","slug":"error-retrieving-subnet-with-id-s-v","errorCode":null,"errorMessage":"error retrieving subnet with id %s: %v","messagePattern":"error retrieving subnet with id (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/openstack/network.go","lineNumber":82,"sourceCode":"\tif err != nil {\n\t\treturn err\n\t} else if done {\n\t\treturn nil\n\t} else {\n\t\treturn wait.ErrWaitTimeout\n\t}\n}\n\nfunc (c *openstackCloud) FindNetworkBySubnetID(subnetID string) (*networks.Network, error) {\n\treturn findNetworkBySubnetID(c, subnetID)\n}\n\nfunc findNetworkBySubnetID(c OpenstackCloud, subnetID string) (*networks.Network, error) {\n\tvar rslt *networks.Network\n\tdone, err := vfs.RetryWithBackoff(readBackoff, func() (bool, error) {\n\t\tsubnet, err := c.GetSubnet(subnetID)\n\t\tif err != nil {\n\t\t\treturn false, fmt.Errorf(\"error retrieving subnet with id %s: %v\", subnetID, err)\n\t\t}\n\n\t\tnetID := subnet.NetworkID\n\t\tnet, err := c.GetNetwork(netID)\n\t\tif err != nil {\n\t\t\treturn false, fmt.Errorf(\"error retrieving network with id %s: %v\", netID, err)\n\t\t}\n\t\trslt = net\n\t\treturn true, nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t} else if done {\n\t\treturn rslt, nil\n\t} else {\n\t\treturn nil, wait.ErrWaitTimeout\n\t}\n}","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/openstack/network.go#L64-L100","documentation":"Resolving a network by subnet ID failed because the GetSubnet call for that ID errored. The lookup is retried with backoff; persistence means the subnet is unreachable, deleted, or the API/credentials are broken.","triggerScenarios":"GetSubnet returns 404 (subnet ID wrong or deleted), 403 (project lacks access to the subnet), or a network/API error.","commonSituations":"Cluster spec references a subnetID from another project/region; subnet deleted out-of-band; typo in subnet ID; Neutron API outage.","solutions":[],"exampleFix":"// before\nsubnetID: \"bad-id\"\n// after\nsubnetID: \"0f3d1a1e-...\"  # from `openstack subnet list`","handlingStrategy":"validation","validationCode":"// verify subnet exists and is accessible before calling findNetworkBySubnetID\nsubnet, err := osClient.NetworkingV2().Subnets.Get(ctx, subnetID).Extract()\n// err must be nil and subnet must belong to the target project","typeGuard":"func subnetExists(c openstack.OpenstackCloud, id string) bool {\n    _, err := c.GetSubnet(id)\n    return err == nil\n}","tryCatchPattern":"net, err := findNetworkBySubnetID(c, subnetID)\nif err != nil {\n    return fmt.Errorf(\"check subnetID %q: %w\", subnetID, err)\n}","preventionTips":["Copy subnet IDs from `openstack subnet list` to avoid typos","Ensure cluster spec subnet belongs to the same project/region as credentials","Don't delete subnets referenced by cluster specs"],"tags":["openstack","neutron","subnet","lookup"],"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"}