{"record":{"id":"389c492f1679b5aa","repo":"kubernetes/kops","slug":"expected-exactly-one-subnet-for-gce-got-d","errorCode":null,"errorMessage":"expected exactly one subnet for GCE, got %d","messagePattern":"expected exactly one subnet for GCE, got (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/new_cluster.go","lineNumber":754,"sourceCode":"\t\tfor _, zoneName := range allZones.List() {\n\t\t\tregion, err := gce.ZoneToRegion(zoneName)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\t// We create default subnets named the same as the regions\n\t\t\tsubnetName := region\n\n\t\t\tsubnet := model.FindSubnet(cluster, subnetName)\n\t\t\tif subnet == nil {\n\t\t\t\tsubnet = &api.ClusterSubnetSpec{\n\t\t\t\t\tName:   subnetName,\n\t\t\t\t\tRegion: region,\n\t\t\t\t}\n\t\t\t\tif len(opt.SubnetIDs) != 0 {\n\t\t\t\t\t// We don't support multi-region clusters, so we can't have more than one subnet\n\t\t\t\t\tif len(opt.SubnetIDs) != 1 {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"expected exactly one subnet for GCE, got %d\", len(opt.SubnetIDs))\n\t\t\t\t\t}\n\t\t\t\t\tsubnet.ID = opt.SubnetIDs[0]\n\t\t\t\t}\n\t\t\t\tcluster.Spec.Networking.Subnets = append(cluster.Spec.Networking.Subnets, *subnet)\n\t\t\t}\n\t\t\tzoneToSubnetsMap[zoneName] = append(zoneToSubnetsMap[zoneName], subnet)\n\t\t}\n\n\t\treturn zoneToSubnetsMap, nil\n\n\tcase api.CloudProviderDO:\n\t\tif len(opt.Zones) > 1 {\n\t\t\treturn nil, fmt.Errorf(\"digitalocean cloud provider currently supports one region only.\")\n\t\t}\n\n\t\t// For DO we just pass in the region for --zones\n\t\tregion := opt.Zones[0]\n\t\tsubnet := model.FindSubnet(cluster, region)","sourceCodeStart":736,"sourceCodeEnd":772,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/new_cluster.go#L736-L772","documentation":"setupZones (GCE branch) validation: fires when more than one subnet ID is provided for a GCE cluster. Because GCE clusters in kOps are single-region and one subnet per region, multiple --subnet-ids cannot be mapped, so creation aborts with the offending count.","triggerScenarios":"Thrown at upup/pkg/fi/cloudup/new_cluster.go:754 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass exactly one subnet ID for GCE clusters","Keep the cluster single-region; create separate clusters for other regions"],"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"}