{"record":{"id":"92832b2956f3f814","repo":"kubernetes/kops","slug":"on-gce-subnets-must-include-regions","errorCode":null,"errorMessage":"on GCE, subnets must include Regions","messagePattern":"on GCE, subnets must include Regions","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/utils.go","lineNumber":56,"sourceCode":")\n\nfunc BuildCloud(cluster *kops.Cluster) (fi.Cloud, error) {\n\tvar cloud fi.Cloud\n\tctx := context.TODO()\n\n\tregion := \"\"\n\tproject := \"\"\n\n\tswitch cluster.GetCloudProvider() {\n\tcase kops.CloudProviderGCE:\n\t\t{\n\t\t\tfor _, subnet := range cluster.Spec.Networking.Subnets {\n\t\t\t\tif subnet.Region != \"\" {\n\t\t\t\t\tregion = subnet.Region\n\t\t\t\t}\n\t\t\t}\n\t\t\tif region == \"\" {\n\t\t\t\treturn nil, fmt.Errorf(\"on GCE, subnets must include Regions\")\n\t\t\t}\n\n\t\t\tproject = cluster.Spec.CloudProvider.GCE.Project\n\t\t\tif project == \"\" {\n\t\t\t\treturn nil, fmt.Errorf(\"project is required for GCE - try gcloud config get-value project\")\n\t\t\t}\n\n\t\t\tclusterLabel := gce.LabelForCluster(cluster.ObjectMeta.Name)\n\t\t\tlabels := map[string]string{clusterLabel.Key: clusterLabel.Value}\n\n\t\t\tgceCloud, err := gce.NewGCECloud(region, project, labels)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tcloud = gceCloud\n\t\t}\n","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/utils.go#L38-L74","documentation":"A configuration validation in BuildCloud for GCE clusters: none of the subnets under spec.networking.subnets has a Region set, so kOps cannot determine the GCP region for API clients. On GCE the region is discovered from subnet definitions rather than a dedicated field, so all-empty Regions leave the region unresolved.","triggerScenarios":"Thrown at upup/pkg/fi/cloudup/utils.go:56 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Edit the cluster spec and set region on at least one subnet in spec.networking.subnets (e.g. us-central1)","Ensure subnets are defined with proper GCE regions when creating the cluster (kops edit cluster)","For scripts, generate subnets from the target GCP region instead of leaving Region blank"],"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"}