{"record":{"id":"108faf98f38449e9","repo":"kubernetes/kops","slug":"cannot-apply-changes-to-subnet-v","errorCode":null,"errorMessage":"cannot apply changes to Subnet: %v","messagePattern":"cannot apply changes to Subnet: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/gcetasks/subnet.go","lineNumber":176,"sourceCode":"\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tchanges.SecondaryIpRanges = nil\n\t\t}\n\n\t\tif changes.StackType != nil {\n\t\t\tif err := updateStackTypeAndIPv6AccessType(cloud, e); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tchanges.StackType = nil\n\t\t\tchanges.Ipv6AccessType = nil\n\t\t}\n\n\t\tempty := &Subnet{}\n\t\tif !reflect.DeepEqual(empty, changes) {\n\t\t\treturn fmt.Errorf(\"cannot apply changes to Subnet: %v\", changes)\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc updateSecondaryRanges(cloud gce.GCECloud, op string, e *Subnet) error {\n\t// We need to refetch to patch it\n\tsubnet, err := cloud.Compute().Subnetworks().Get(cloud.Project(), cloud.Region(), *e.Name)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error fetching subnet for patch: %w\", err)\n\t}\n\n\texpectedRanges := e.SecondaryIpRanges\n\n\tactualRanges := make(map[string]string)\n\tfor _, r := range subnet.SecondaryIpRanges {\n\t\tactualRanges[r.RangeName] = r.IpCidrRange","sourceCodeStart":158,"sourceCodeEnd":194,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/gcetasks/subnet.go#L158-L194","documentation":"Returned from Subnet.RenderGCE when, after secondary-range and StackType updates are handled, the residual diff is still non-empty. Subnets cannot be resized or moved in place, so remaining changes (e.g. CIDR change) are reported as unappliable.","triggerScenarios":"Thrown at upup/pkg/fi/cloudup/gcetasks/subnet.go:176 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the printed changes to see which fields could not be applied","Align the cluster spec's subnet settings with the live subnet","Recreate the subnet (usually only feasible for non-shared, non-production networks) if the CIDR must change"],"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-12T12:17:11.808Z"}