{"record":{"id":"02ae47c32f0a94d4","repo":"kubernetes/kops","slug":"subnet-with-name-q-not-found","errorCode":null,"errorMessage":"Subnet with name %q not found","messagePattern":"Subnet with name %q not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/gcetasks/subnet.go","lineNumber":117,"sourceCode":"\tactual.Shared = e.Shared\n\n\treturn actual, nil\n}\n\nfunc (e *Subnet) Run(c *fi.CloudupContext) error {\n\treturn fi.CloudupDefaultDeltaRunMethod(e, c)\n}\n\nfunc (_ *Subnet) CheckChanges(a, e, changes *Subnet) error {\n\treturn nil\n}\n\nfunc (_ *Subnet) RenderGCE(t *gce.GCEAPITarget, a, e, changes *Subnet) error {\n\tshared := fi.ValueOf(e.Shared)\n\tif shared {\n\t\t// Verify the subnet was found\n\t\tif a == nil {\n\t\t\treturn fmt.Errorf(\"Subnet with name %q not found\", fi.ValueOf(e.Name))\n\t\t}\n\t}\n\n\tcloud := t.Cloud\n\tproject := cloud.Project()\n\n\tif a == nil {\n\t\tklog.V(2).Infof(\"Creating Subnet with CIDR: %q\", fi.ValueOf(e.CIDR))\n\n\t\tsubnet := &compute.Subnetwork{\n\t\t\tIpCidrRange:    fi.ValueOf(e.CIDR),\n\t\t\tName:           *e.Name,\n\t\t\tNetwork:        e.Network.URL(project),\n\t\t\tStackType:      fi.ValueOf(e.StackType),\n\t\t\tIpv6AccessType: fi.ValueOf(e.Ipv6AccessType),\n\t\t}\n\n\t\tfor k, v := range e.SecondaryIpRanges {","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/gcetasks/subnet.go#L99-L135","documentation":"Guard error from Subnet.RenderGCE when the spec marks the subnet as shared but Find() found no matching subnet (a == nil). Shared subnets must pre-exist and be adopted, so absence is fatal instead of triggering creation.","triggerScenarios":"Thrown at upup/pkg/fi/cloudup/gcetasks/subnet.go:117 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the subnet name in the spec matches an existing GCE subnetwork in the right region/project","Create the subnet in GCE manually first if adopting it","Drop the shared flag so kOps creates and manages the subnet"],"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"}