{"record":{"id":"75e593a3d63b709a","repo":"kubernetes/kops","slug":"error-creating-router-interface-v-75e593","errorCode":null,"errorMessage":"Error creating router interface: %v","messagePattern":"Error creating router interface: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/openstacktasks/routerinterface.go","lineNumber":131,"sourceCode":"\t\t\treturn fi.CannotChangeField(\"Router\")\n\t\t}\n\t\tif changes.Subnet != nil {\n\t\t\treturn fi.CannotChangeField(\"Subnet\")\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (_ *RouterInterface) RenderOpenstack(t *openstack.OpenstackAPITarget, a, e, changes *RouterInterface) error {\n\tif a == nil {\n\t\trouterID := fi.ValueOf(e.Router.ID)\n\t\tsubnetID := fi.ValueOf(e.Subnet.ID)\n\t\tklog.V(2).Infof(\"Creating RouterInterface for router:%s and subnet:%s\", routerID, subnetID)\n\n\t\topt := routers.AddInterfaceOpts{SubnetID: subnetID}\n\t\tv, err := t.Cloud.CreateRouterInterface(routerID, opt)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error creating router interface: %v\", err)\n\t\t}\n\n\t\te.ID = new(v.PortID)\n\t\tklog.V(2).Infof(\"Creating a new Openstack router interface, id=%s\", v.PortID)\n\t\treturn nil\n\t}\n\te.ID = a.ID\n\tklog.V(2).Infof(\"Using an existing Openstack router interface, id=%s\", fi.ValueOf(e.ID))\n\treturn nil\n}\n","sourceCodeStart":113,"sourceCodeEnd":142,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/openstacktasks/routerinterface.go#L113-L142","documentation":"Raised in RenderOpenstack (routerinterface.go:131) when the Neutron add-router-interface API (Cloud.CreateRouterInterface) returns an error while attaching a subnet to the router. The gophercloud error is wrapped verbatim, so the underlying conflict or validation failure is in the inner message.","triggerScenarios":"routers.AddInterfaceOpts{SubnetID} is submitted for a router that cannot accept the interface: 409 Conflict because the subnet's IP range overlaps another interface's subnet on the same router, the router or subnet doesn't exist (404), the port creation inside Neutron fails, or the subnet already has an interface attached.","commonSituations":"Two private subnets with overlapping CIDRs attached to one router (Neutron rejects overlap), the Router task's ID is stale/invalid from a failed earlier run, network MTU/port-quota issues preventing the internal port creation, or applying against the wrong project where the router/subnet IDs don't resolve.","solutions":["Read the wrapped inner error; a 409 usually means overlapping subnets on the router — check `openstack subnet list` for CIDR overlap","Verify the router ID exists in the current project: `openstack router show <router-id>`","Check port quota: `openstack quota show` (ports) and delete stale ports","Re-run `kops update cluster` after fixing; if state is corrupted, detach stale interfaces first"],"exampleFix":"// before\nERROR: Error creating router interface: Conflict: Multiple subnets with overlapping CIDR\n// after\n$ openstack subnet set --no-allocation-pool ...   # or fix cluster spec so subnets don't overlap\n$ kops update cluster <name> --yes","handlingStrategy":"try-catch","validationCode":"// pre-check for overlapping subnets on the router\nsubs, _ := subnets.List(netClient, subnets.ListOpts{NetworkID: netID}).AllPages()\nfor _, s := range subs { for _, o := range subs { if s.ID != o.ID && cidrOverlaps(s.CIDR, o.CIDR) { return fmt.Errorf(\"subnets %s and %s overlap\", s.ID, o.ID) } } }","typeGuard":"func isConflict(err error) bool {\n    var gerr gophercloud.ErrUnexpectedResponseCode\n    return errors.As(err, &gerr) && gerr.Actual == http.StatusConflict\n}","tryCatchPattern":"if err := kopsUpdate(); err != nil {\n    if isConflict(err) {\n        log.Fatal(\"router interface conflict (likely overlapping subnets) — check `openstack subnet list` CIDRs\")\n    }\n    return err\n}","preventionTips":["Keep cluster private subnets on non-overlapping CIDRs","Verify router/subnet IDs exist in the target project before applying","Check port quota before large cluster applies","Retry after transient Neutron failures only after confirming no partial interface was created"],"tags":["openstack","router-interface","neutron","api-error"],"backgroundTag":"router-interface-creation-failed","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"}