cilium/cilium · error

BGP router manager is not running

Error message

BGP router manager is not running

What it means

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.

Source

Thrown at pkg/bgp/manager/manager.go:270

	var res []*models.BgpPeer
	for _, i := range m.BGPInstances {
		getPeerResp, err := i.Router.GetPeerStateLegacy(ctx)
		if err != nil {
			return nil, err
		}
		res = append(res, getPeerResp.Peers...)
	}
	return res, nil
}

// GetRoutes retrieves routes from the RIB of underlying routers.
func (m *BGPRouterManager) GetRoutes(ctx context.Context, req *agent.GetRoutesRequest) (*agent.GetRoutesResponse, error) {
	m.RLock()
	defer m.RUnlock()

	if !m.running {
		return nil, fmt.Errorf("BGP router manager is not running")
	}
	if req == nil {
		return nil, fmt.Errorf("get routes request is nil")
	}

	var res agent.GetRoutesResponse
	for _, i := range m.BGPInstances {
		switch req.TableType {
		case types.TableTypeAdjRIBIn, types.TableTypeAdjRIBOut:
			peerState, err := i.Router.GetPeerState(ctx, &types.GetPeerStateRequest{})
			if err != nil {
				return nil, err
			}
			for _, peer := range peerState.Peers {
				rs, err := i.Router.GetRoutes(ctx, &types.GetRoutesRequest{
					TableType: req.TableType,
					Family:    req.Family,
					Neighbor:  peer.Address,

View on GitHub (pinned to ac7b90affa)

Solutions

  1. Check agent/manager readiness (health endpoint or startup completion) before calling GetRoutes.
  2. Inspect agent logs for BGP startup errors and fix the underlying failure so Start() sets running=true.
  3. Restart the agent if the manager was stopped; re-run the route query afterwards.
  4. Distinguish this error from the nil-request error to avoid chasing the wrong cause.

Example fix

// before
resp, err := mgr.GetRoutes(ctx, req) // fails if manager stopped
// after
if err := waitForManagerReady(ctx, mgr); err != nil {
    return err
}
resp, err := mgr.GetRoutes(ctx, req)
Defensive patterns

Strategy: try-catch

Validate before calling

if !bgpManagerReady() {
    return errors.New("bgp manager not running; cannot fetch routes")
}

Try / catch

resp, err := mgr.GetRoutes(ctx, req)
if err != nil {
    if strings.Contains(err.Error(), "not running") {
        // manager state problem: wait/restart, do not resend immediately
    } else {
        // request problem: fix the request
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of cilium/cilium@ac7b90affa (2026-08-31). Data as JSON: /api/errors/3f79456104d65d89. Report an issue: GitHub.