{"record":{"id":"49f9a7212cbfe9de","repo":"kubernetes/kops","slug":"error-listing-routers-w","errorCode":null,"errorMessage":"error listing Routers: %w","messagePattern":"error listing Routers: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/gcetasks/router.go","lineNumber":76,"sourceCode":"}\n\nvar _ fi.CompareWithID = (*Router)(nil)\n\n// CompareWithID returns the name of the Router.\nfunc (r *Router) CompareWithID() *string {\n\treturn r.Name\n}\n\n// Find discovers the Router in the cloud provider.\nfunc (r *Router) Find(c *fi.CloudupContext) (*Router, error) {\n\tcloud := c.T.Cloud.(gce.GCECloud)\n\n\tfound, err := cloud.Compute().Routers().Get(cloud.Project(), *r.Region, *r.Name)\n\tif err != nil {\n\t\tif gce.IsNotFound(err) {\n\t\t\treturn nil, nil\n\t\t}\n\t\treturn nil, fmt.Errorf(\"error listing Routers: %w\", err)\n\t}\n\n\tif len(found.Nats) != 1 {\n\t\treturn nil, fmt.Errorf(\"unexpected number of nats found: %+v\", found.Nats)\n\t}\n\tnat := found.Nats[0]\n\n\tif a, e := found.SelfLink, r.url(cloud.Project()); a != e {\n\t\tklog.Warningf(\"SelfLink did not match URL: %q vs %q\", a, e)\n\t}\n\n\tactual := &Router{\n\t\tName:                          &found.Name,\n\t\tLifecycle:                     r.Lifecycle,\n\t\tNetwork:                       &Network{Name: new(lastComponent(found.Network))},\n\t\tRegion:                        new(lastComponent(found.Region)),\n\t\tNATIPAllocationOption:         &nat.NatIpAllocateOption,\n\t\tSourceSubnetworkIPRangesToNAT: &nat.SourceSubnetworkIpRangesToNat,","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/gcetasks/router.go#L58-L94","documentation":"Wrapped error from Router.Find when the Routers.Get call fails with a non-404 error. The 'listing' wording is misleading — it is a single-router Get during discovery; fires on permissions, wrong region/name, or GCE API failures.","triggerScenarios":"Thrown at upup/pkg/fi/cloudup/gcetasks/router.go:76 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped error for the Google API reason","Verify the router name and region in the spec","Ensure compute.routers.get permission on the project"],"exampleFix":null,"handlingStrategy":"try-catch","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"}