{"record":{"id":"5d03a7d310ccc276","repo":"kubernetes/kops","slug":"egressonlyinternetgateway-internetgateway-instan","errorCode":null,"errorMessage":"EgressOnlyInternetGateway, InternetGateway, Instance, NatGateway, TransitGateway, or VpcPeeringConnection is required","messagePattern":"EgressOnlyInternetGateway, InternetGateway, Instance, NatGateway, TransitGateway, or VpcPeeringConnection is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/awstasks/route.go","lineNumber":168,"sourceCode":"\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 {\n\t\t\ttargetCount++\n\t\t}\n\t\tif e.VPCPeeringConnectionID != nil {\n\t\t\ttargetCount++\n\t\t}\n\t\tif targetCount == 0 {\n\t\t\treturn fmt.Errorf(\"EgressOnlyInternetGateway, InternetGateway, Instance, NatGateway, TransitGateway, or VpcPeeringConnection is required\")\n\t\t}\n\t\tif targetCount != 1 {\n\t\t\treturn fmt.Errorf(\"cannot set more than one EgressOnlyInternetGateway, InternetGateway, Instance, NatGateway, TransitGateway, or VpcPeeringConnection\")\n\t\t}\n\t}\n\n\tif a != nil {\n\t\tif changes.RouteTable != nil {\n\t\t\treturn fi.CannotChangeField(\"RouteTable\")\n\t\t}\n\t\tif changes.CIDR != nil {\n\t\t\treturn fi.CannotChangeField(\"CIDR\")\n\t\t}\n\t\tif changes.IPv6CIDR != nil {\n\t\t\treturn fi.CannotChangeField(\"IPv6CIDR\")\n\t\t}\n\t}\n\treturn nil","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/awstasks/route.go#L150-L186","documentation":"This error is raised in Route task CheckChanges when no route target is specified at all. An AWS route must point to exactly one target type (EgressOnlyInternetGateway, InternetGateway, Instance, NatGateway, TransitGateway, or VpcPeeringConnection); kOps rejects routes with zero targets before calling AWS.","triggerScenarios":"Defining a Route task with a CIDR/IPv6CIDR destination but leaving all target fields (EgressOnlyInternetGateway, InternetGateway, Instance, NatGateway, TransitGatewayID, VPCPeeringConnectionID) nil.","commonSituations":"Hand-writing route entries in a cluster manifest and forgetting the target; a templating tool dropping a field; deleting the target stanza during refactor.","solutions":["Add the intended target (e.g. internetGateway: igw-123 or natGateway: nat-456) to the route","Check the upstream data source that generated the route to ensure the target field is populated","Validate the manifest with kops before applying"],"exampleFix":"// before\nroute:\n  cidr: 0.0.0.0/0\n// after\nroute:\n  cidr: 0.0.0.0/0\n  internetGateway: igw-0abc123","handlingStrategy":"validation","validationCode":"func hasRouteTarget(r Route) bool {\n\treturn r.EgressOnlyInternetGateway != nil || r.InternetGateway != nil ||\n\t\tr.Instance != nil || r.NatGateway != nil ||\n\t\tr.TransitGatewayID != nil || r.VPCPeeringConnectionID != nil\n}\nif !hasRouteTarget(route) { return errors.New(\"route requires exactly one target\") }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never hand-write a Route entry without a target field","Run kops update cluster with --dry-run to catch missing targets before apply","Keep target fields populated by the same data source that sets the CIDR"],"tags":["aws","route","validation","missing-target"],"backgroundTag":"missing-required-argument","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"}