{"record":{"id":"5ba21ac69d1d26d5","repo":"kubernetes/kops","slug":"error-listing-subnets-w","errorCode":null,"errorMessage":"error listing Subnets: %w","messagePattern":"error listing Subnets: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/gcetasks/subnet.go","lineNumber":70,"sourceCode":"\nfunc (e *Subnet) CompareWithID() *string {\n\treturn e.Name\n}\n\nfunc (e *Subnet) Find(c *fi.CloudupContext) (*Subnet, error) {\n\tcloud := c.T.Cloud.(gce.GCECloud)\n\t_, project, err := gce.ParseNameAndProjectFromNetworkID(c.T.Cluster.Spec.Networking.NetworkID)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing network name from cluster spec: %w\", err)\n\t} else if project == \"\" {\n\t\tproject = cloud.Project()\n\t}\n\ts, err := cloud.Compute().Subnetworks().Get(project, cloud.Region(), *e.Name)\n\tif err != nil {\n\t\tif gce.IsNotFound(err) {\n\t\t\treturn nil, nil\n\t\t}\n\t\treturn nil, fmt.Errorf(\"error listing Subnets: %w\", err)\n\t}\n\n\tactual := &Subnet{}\n\tactual.Name = &s.Name\n\tactual.Network = &Network{Name: new(lastComponent(s.Network))}\n\tactual.Region = new(lastComponent(s.Region))\n\tactual.CIDR = &s.IpCidrRange\n\tactual.StackType = &s.StackType\n\tactual.Ipv6AccessType = &s.Ipv6AccessType\n\n\tshared := fi.ValueOf(e.Shared)\n\t{\n\t\tactual.SecondaryIpRanges = make(map[string]string)\n\t\tfor _, r := range s.SecondaryIpRanges {\n\t\t\tif shared {\n\t\t\t\t// In the shared case, only show differences on the ranges we specified\n\t\t\t\tif _, found := e.SecondaryIpRanges[r.RangeName]; !found {\n\t\t\t\t\tcontinue","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/gcetasks/subnet.go#L52-L88","documentation":"Wrapped error from Subnet.Find when the Subnetworks.Get call (against the project derived from NetworkID, falling back to the cloud project) fails with a non-404 error. Despite the 'listing' wording it is a single-subnet Get; fires on permissions, wrong region/name, or API failures.","triggerScenarios":"Thrown at upup/pkg/fi/cloudup/gcetasks/subnet.go:70 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped error for the Google API reason","Verify the subnet name, region, and the project resolved from NetworkID","Ensure compute.subnetworks.get permission on that project"],"exampleFix":null,"handlingStrategy":"try-catch","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"}