{"record":{"id":"3f79456104d65d89","repo":"cilium/cilium","slug":"bgp-router-manager-is-not-running-3f7945","errorCode":null,"errorMessage":"BGP router manager is not running","messagePattern":"BGP router manager is not running","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/bgp/manager/manager.go","lineNumber":270,"sourceCode":"\n\tvar res []*models.BgpPeer\n\tfor _, i := range m.BGPInstances {\n\t\tgetPeerResp, err := i.Router.GetPeerStateLegacy(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tres = append(res, getPeerResp.Peers...)\n\t}\n\treturn res, nil\n}\n\n// GetRoutes retrieves routes from the RIB of underlying routers.\nfunc (m *BGPRouterManager) GetRoutes(ctx context.Context, req *agent.GetRoutesRequest) (*agent.GetRoutesResponse, error) {\n\tm.RLock()\n\tdefer m.RUnlock()\n\n\tif !m.running {\n\t\treturn nil, fmt.Errorf(\"BGP router manager is not running\")\n\t}\n\tif req == nil {\n\t\treturn nil, fmt.Errorf(\"get routes request is nil\")\n\t}\n\n\tvar res agent.GetRoutesResponse\n\tfor _, i := range m.BGPInstances {\n\t\tswitch req.TableType {\n\t\tcase types.TableTypeAdjRIBIn, types.TableTypeAdjRIBOut:\n\t\t\tpeerState, err := i.Router.GetPeerState(ctx, &types.GetPeerStateRequest{})\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tfor _, peer := range peerState.Peers {\n\t\t\t\trs, err := i.Router.GetRoutes(ctx, &types.GetRoutesRequest{\n\t\t\t\t\tTableType: req.TableType,\n\t\t\t\t\tFamily:    req.Family,\n\t\t\t\t\tNeighbor:  peer.Address,","sourceCodeStart":252,"sourceCodeEnd":288,"githubUrl":"https://github.com/cilium/cilium/blob/ac7b90affa4baf0642e6685319d56907b3a73a6d/pkg/bgp/manager/manager.go#L252-L288","documentation":"GetRoutes reads routes from the RIB of the underlying GoBGP routers. Before doing so it verifies the manager is running; if the BGP subsystem was never started or has been shut down, it returns this capitalized variant of the not-running error. This prevents reads against instances with no live BGP server.","triggerScenarios":"Calling GetRoutes(ctx, *agent.GetRoutesRequest) when m.running is false: agent still initializing, BGP disabled, or manager stopped. Note the nil-request case is a separate error.","commonSituations":"Route dump automation runs before agent readiness; agent crashed/restarted and the BGP manager never came back up; environment where the routing agent was deliberately stopped for maintenance.","solutions":["Check agent/manager readiness (health endpoint or startup completion) before calling GetRoutes.","Inspect agent logs for BGP startup errors and fix the underlying failure so Start() sets running=true.","Restart the agent if the manager was stopped; re-run the route query afterwards.","Distinguish this error from the nil-request error to avoid chasing the wrong cause."],"exampleFix":"// before\nresp, err := mgr.GetRoutes(ctx, req) // fails if manager stopped\n// after\nif err := waitForManagerReady(ctx, mgr); err != nil {\n    return err\n}\nresp, err := mgr.GetRoutes(ctx, req)","handlingStrategy":"try-catch","validationCode":"if !bgpManagerReady() {\n    return errors.New(\"bgp manager not running; cannot fetch routes\")\n}","typeGuard":null,"tryCatchPattern":"resp, err := mgr.GetRoutes(ctx, req)\nif err != nil {\n    if strings.Contains(err.Error(), \"not running\") {\n        // manager state problem: wait/restart, do not resend immediately\n    } else {\n        // request problem: fix the request\n    }\n}","preventionTips":["Check manager readiness before RIB queries.","Distinguish the not-running error from the nil-request error when troubleshooting.","Add readiness probes to automation that dumps routes.","Restart the agent cleanly after any intentional stop."],"tags":["bgp","not-running","rib","lifecycle"],"backgroundTag":"service-not-running","analyzedSha":"ac7b90affa4baf0642e6685319d56907b3a73a6d","analyzedAt":"2026-08-31T18:27:15.868Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}