{"record":{"id":"a1c7e31609807f27","repo":"kubernetes/kops","slug":"cannot-set-more-than-one-cidr-or-ipv6cidr","errorCode":null,"errorMessage":"cannot set more than one CIDR or IPv6CIDR","messagePattern":"cannot set more than one CIDR or IPv6CIDR","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/awstasks/route.go","lineNumber":143,"sourceCode":"\n\treturn nil, nil\n}\n\nfunc (e *Route) Run(c *fi.CloudupContext) error {\n\treturn fi.CloudupDefaultDeltaRunMethod(e, c)\n}\n\nfunc (s *Route) CheckChanges(a, e, changes *Route) error {\n\tif a == nil {\n\t\t// TODO: Create validate method?\n\t\tif e.RouteTable == nil {\n\t\t\treturn fi.RequiredField(\"RouteTable\")\n\t\t}\n\t\tif e.CIDR == nil && e.IPv6CIDR == nil {\n\t\t\treturn fi.RequiredField(\"CIDR/IPv6CIDR\")\n\t\t}\n\t\tif e.CIDR != nil && e.IPv6CIDR != nil {\n\t\t\treturn fmt.Errorf(\"cannot set more than one CIDR or IPv6CIDR\")\n\t\t}\n\t\ttargetCount := 0\n\t\tif e.EgressOnlyInternetGateway != nil {\n\t\t\ttargetCount++\n\t\t\tif e.CIDR != nil {\n\t\t\t\treturn fmt.Errorf(\"cannot route IPv4 to an EgressOnlyInternetGateway\")\n\t\t\t}\n\t\t}\n\t\tif e.InternetGateway != nil {\n\t\t\ttargetCount++\n\t\t}\n\t\tif e.Instance != nil {\n\t\t\ttargetCount++\n\t\t}\n\t\tif e.NatGateway != nil {\n\t\t\ttargetCount++\n\t\t}\n\t\tif e.TransitGatewayID != nil {","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/awstasks/route.go#L125-L161","documentation":"This validation error is raised in Route task CheckChanges when both CIDR (IPv4) and IPv6CIDR destination fields are set on a route. AWS routes can only have one destination CIDR block — either IPv4 or IPv6 — never both simultaneously. It is a pre-flight guard before calling AWS.","triggerScenarios":"Defining a route in the kOps cluster spec with both `cidr` and `ipv6Cidr` fields populated on the same Route task object.","commonSituations":"Copy-pasting a route definition and adding an IPv6 field without removing the IPv4 field; template generation tools emitting both fields; merging cluster specs from IPv4 and IPv6 configurations.","solutions":["Remove the CIDR field if this route is IPv6-only","Remove the IPv6CIDR field if this route is IPv4-only","Split into two separate Route tasks, one for each CIDR","Regenerate the manifest with kops toolbox to eliminate the duplicate"],"exampleFix":"// before\nroute:\n  cidr: 0.0.0.0/0\n  ipv6Cidr: ::/0\n// after\nroute:\n  ipv6Cidr: ::/0","handlingStrategy":"validation","validationCode":"func validateRoute(r Route) error {\n\tif r.CIDR != nil && r.IPv6CIDR != nil {\n\t\treturn errors.New(\"cannot set more than one CIDR or IPv6CIDR\")\n\t}\n\tif r.CIDR == nil && r.IPv6CIDR == nil {\n\t\treturn errors.New(\"CIDR/IPv6CIDR required\")\n\t}\n\treturn nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep IPv4 and IPv6 routes as separate Route entries in the manifest","Run kops validate/toolbox lint before apply","Grep manifests for simultaneous cidr + ipv6Cidr keys on the same route"],"tags":["aws","route","validation","ipv6"],"backgroundTag":"mutually-exclusive-fields","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"}