{"record":{"id":"1bd84ef26057666c","repo":"kubernetes/kops","slug":"could-not-find-subnet-s-from-clusterspec","errorCode":null,"errorMessage":"could not find subnet %s from clusterSpec","messagePattern":"could not find subnet (.+?) from clusterSpec","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/model/openstackmodel/context.go","lineNumber":91,"sourceCode":"\nfunc (c *OpenstackModelContext) APIResourceName() string {\n\tif c.Cluster.Spec.API.PublicName != \"\" {\n\t\treturn c.Cluster.Spec.API.PublicName\n\t}\n\treturn \"api.\" + c.ClusterName()\n}\n\nfunc (c *OpenstackModelContext) findSubnetClusterSpec(subnet string) (string, kops.SubnetType, error) {\n\tfor _, sp := range c.Cluster.Spec.Networking.Subnets {\n\t\tif sp.Name == subnet {\n\t\t\tname, err := c.findSubnetNameByID(sp.ID, sp.Name)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", \"\", err\n\t\t\t}\n\t\t\treturn name, sp.Type, nil\n\t\t}\n\t}\n\treturn \"\", \"\", fmt.Errorf(\"could not find subnet %s from clusterSpec\", subnet)\n}\n\nfunc (c *OpenstackModelContext) findSubnetNameByID(subnetID string, subnetName string) (string, error) {\n\tif subnetID == \"\" {\n\t\treturn subnetName + \".\" + c.ClusterName(), nil\n\t}\n\n\tosCloud, err := c.createCloud()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tsubnet, err := osCloud.GetSubnet(subnetID)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn subnet.Name, nil\n}","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/model/openstackmodel/context.go#L73-L109","documentation":"While building OpenStack instances, a subnet referenced by name had no matching entry in cluster.spec.networking.subnets. The lookup iterates the cluster spec's subnets and falls through to this generic not-found guard, so the subnet name/ID at fault is one referenced by the instance group or network model but absent from the spec.","triggerScenarios":"Thrown at pkg/model/openstackmodel/context.go:91 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add the subnet to spec.networking.subnets in the cluster spec with its name and ID","Check for typos or renaming between the instance group's subnet references and the spec","Re-create the cluster spec if subnets were removed out-of-band"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}