{"record":{"id":"b977ef695a37a49e","repo":"kubernetes/kops","slug":"error-creating-router-v-b977ef","errorCode":null,"errorMessage":"Error creating router: %v","messagePattern":"Error creating router: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/openstacktasks/router.go","lineNumber":126,"sourceCode":"\t\topt.GatewayInfo = &routers.GatewayInfo{\n\t\t\tNetworkID: floatingNet.ID,\n\t\t}\n\n\t\trouterFloatingSubnet, err := t.Cloud.GetExternalSubnet()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to find floatingip subnet: %v\", err)\n\t\t}\n\t\tif routerFloatingSubnet != nil {\n\t\t\topt.GatewayInfo.ExternalFixedIPs = []routers.ExternalFixedIP{\n\t\t\t\t{\n\t\t\t\t\tSubnetID: routerFloatingSubnet.ID,\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\n\t\tv, err := t.Cloud.CreateRouter(opt)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error creating router: %v\", err)\n\t\t}\n\t\te.ID = new(v.ID)\n\t\tklog.V(2).Infof(\"Creating a new Openstack router, id=%s\", v.ID)\n\t\treturn nil\n\t}\n\te.ID = a.ID\n\tklog.V(2).Infof(\"Using an existing Openstack router, id=%s\", fi.ValueOf(e.ID))\n\treturn nil\n}\n","sourceCodeStart":108,"sourceCodeEnd":136,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/openstacktasks/router.go#L108-L136","documentation":"Raised in RenderOpenstack (router.go:126) when the Neutron router-create API call (Cloud.CreateRouter) returns an error after the gateway options were successfully assembled. kOps wraps the gophercloud error with this message, so the root cause is always in the wrapped text — quota, auth, or invalid gateway data.","triggerScenarios":"cloud.CreateRouter(opt) fails during cluster creation: Neutron returns 409/403 (quota exceeded for routers, admin-state or gateway network not external), 401 auth expiry, 400 invalid GatewayInfo (ExternalFixedIPs subnet not on the external network), or a network timeout.","commonSituations":"Router quota exhausted in the project (most common), external network flagged router:external=false, the floating subnet ID from GetExternalSubnet doesn't belong to the gateway network, expired OpenStack credentials during a long apply, or Neutron service degraded.","solutions":["Read the wrapped inner error; if it's a quota conflict, check `openstack quota show` and delete unused routers or raise the router quota","Confirm the external network has router:external=true: `openstack network show <ext-net>`","Verify the floating subnet belongs to the same external network used as gateway","Re-authenticate / refresh credentials and re-run `kops update cluster`"],"exampleFix":"// before\nERROR: Error creating router: Request forbidden: Quota exceeded for resource router\n// after\n$ openstack quota set --routers 10 <project>   # or delete stale routers\n$ kops update cluster <name> --yes","handlingStrategy":"try-catch","validationCode":"// pre-check router quota and external flag\nq, _ := netClient.GetQuota(projectID).Extract()\nextNet, _ := networks.Get(netClient, extNetID).Extract()\nif q.Router >= q.RouterLimit || !extNet.External { return errors.New(\"router quota exhausted or network not external\") }","typeGuard":"func isQuotaError(err error) bool {\n    var gerr gophercloud.ErrUnexpectedResponseCode\n    return errors.As(err, &gerr) && gerr.Actual == http.StatusConflict\n}","tryCatchPattern":"err := kopsUpdate(); if err != nil {\n    var gerr gophercloud.ErrUnexpectedResponseCode\n    if errors.As(err, &gerr) {\n        switch gerr.Actual {\n        case http.StatusConflict: log.Fatal(\"router quota exceeded — delete unused routers or raise quota\")\n        case http.StatusUnauthorized: log.Fatal(\"re-authenticate OS credentials and retry\")\n        }\n    }\n    return err\n}","preventionTips":["Monitor router quota in the project before applies","Set router:external=true on the gateway network","Refresh credentials for long-running applies","Read the wrapped inner error — it names the exact Neutron rejection"],"tags":["openstack","router","neutron","api-error"],"backgroundTag":"router-creation-failed","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"}