{"record":{"id":"1151ff964fce8ac2","repo":"kubernetes/kops","slug":"could-not-find-private-subnet-in-zone-q","errorCode":null,"errorMessage":"could not find private subnet in zone: %q","messagePattern":"could not find private subnet in zone: %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/model/awsmodel/context.go","lineNumber":96,"sourceCode":"\t\treturn nil, fmt.Errorf(\"found multiple utility subnets in zone: %q\", zoneName)\n\t}\n\n\treturn b.LinkToSubnet(matches[0]), nil\n}\nfunc (b *AWSModelContext) LinkToPrivateSubnetsInZone(zoneName string) ([]*awstasks.Subnet, error) {\n\tvar matches []*kops.ClusterSubnetSpec\n\tfor i := range b.Cluster.Spec.Networking.Subnets {\n\t\ts := &b.Cluster.Spec.Networking.Subnets[i]\n\t\tif s.Zone != zoneName {\n\t\t\tcontinue\n\t\t}\n\t\tif s.Type != kops.SubnetTypePrivate {\n\t\t\tcontinue\n\t\t}\n\t\tmatches = append(matches, s)\n\t}\n\tif len(matches) == 0 {\n\t\treturn nil, fmt.Errorf(\"could not find private subnet in zone: %q\", zoneName)\n\t}\n\n\tvar subnets []*awstasks.Subnet\n\n\tfor _, match := range matches {\n\t\tsubnets = append(subnets, b.LinkToSubnet(match))\n\t}\n\n\treturn subnets, nil\n}\n","sourceCodeStart":78,"sourceCodeEnd":107,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/model/awsmodel/context.go#L78-L107","documentation":"No subnet of type Private exists in the requested zone; the calling task (e.g. NAT gateway or private route table linkage) requires a private subnet in that zone but the cluster spec defines none.","triggerScenarios":"Thrown at pkg/model/awsmodel/context.go:96 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add a private subnet for the zone via kops edit cluster","Review subnet allocation for the zone","Ensure control-plane subnets are typed Private"],"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"}