{"record":{"id":"1c4a5d10aa6f880e","repo":"kubernetes/kops","slug":"error-retrieving-subnet-v","errorCode":null,"errorMessage":"error retrieving subnet: %v","messagePattern":"error retrieving subnet: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/openstack/subnet.go","lineNumber":67,"sourceCode":"\tif err != nil {\n\t\treturn s, err\n\t} else if done {\n\t\treturn s, nil\n\t} else {\n\t\treturn s, wait.ErrWaitTimeout\n\t}\n}\n\nfunc (c *openstackCloud) GetSubnet(subnetID string) (*subnets.Subnet, error) {\n\treturn getSubnet(c, subnetID)\n}\n\nfunc getSubnet(c OpenstackCloud, subnetID string) (*subnets.Subnet, error) {\n\tvar subnet *subnets.Subnet\n\tdone, err := vfs.RetryWithBackoff(readBackoff, func() (bool, error) {\n\t\tsub, err := subnets.Get(context.TODO(), c.NetworkingClient(), subnetID).Extract()\n\t\tif err != nil {\n\t\t\treturn false, fmt.Errorf(\"error retrieving subnet: %v\", err)\n\t\t}\n\t\tsubnet = sub\n\t\treturn true, nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t} else if done {\n\t\treturn subnet, nil\n\t} else {\n\t\treturn nil, wait.ErrWaitTimeout\n\t}\n}\n\nfunc (c *openstackCloud) CreateSubnet(opt subnets.CreateOptsBuilder) (*subnets.Subnet, error) {\n\treturn createSubnet(c, opt)\n}\n\nfunc createSubnet(c OpenstackCloud, opt subnets.CreateOptsBuilder) (*subnets.Subnet, error) {","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/openstack/subnet.go#L49-L85","documentation":"getSubnet fetches a single Neutron subnet by ID inside a RetryWithBackoff loop. If subnets.Get(...).Extract() fails, the error is wrapped as \"error retrieving subnet: %v\". Note the OpenStack SDK returns 404 for a missing subnet, which usually surfaces here as a wrapped gophercloud ErrResourceNotFound.","triggerScenarios":"The subnet ID passed does not exist (deleted out-of-band, wrong region/project), the token lacks read access to the subnet, or Neutron is unreachable.","commonSituations":"Cluster config referencing a subnet deleted manually, cross-project/cross-region subnet reference, expired credentials, or a typo in the subnet UUID in the cluster spec.","solutions":["Verify the subnet UUID exists: `openstack subnet show <subnetID>` in the same project/region","Correct the subnet ID in the kops cluster spec if it was deleted or mistyped","Check RBAC policy if the error is 403","Re-authenticate if the wrapped error is 401"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"func subnetExists(subnetID string) error {\n\tif _, err := exec.Command(\"openstack\", \"subnet\", \"show\", subnetID).Output(); err != nil {\n\t\treturn fmt.Errorf(\"subnet %s not found in project/region\", subnetID)\n\t}\n\treturn nil\n}","typeGuard":"func isNotFoundErr(err error) bool {\n\tvar nf gophercloud.ErrResourceNotFound\n\treturn errors.As(err, &nf)\n}","tryCatchPattern":"sub, err := getSubnet(cloud, id)\nif err != nil {\n\tif isNotFoundErr(err) {\n\t\treturn nil, fmt.Errorf(\"subnet %q does not exist; fix cluster spec\", id)\n\t}\n\treturn nil, err\n}","preventionTips":["Verify subnet UUIDs with openstack CLI before putting them in the spec","Keep subnet IDs in a single source of truth per region","Watch for out-of-band subnet deletion via OpenStack audit logs","Ensure kops runs in the same project/region as the subnet"],"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"}