cilium/cilium · error

table %s requires neighbor parameter

Error message

table %s requires neighbor parameter

What it means

Adj-RIB-In and Adj-RIB-Out tables are per-neighbor views of BGP routes, so a neighbor parameter is mandatory. If GetBgpRoutes is called with one of those table types but no neighbor, this error is returned.

Source

Thrown at pkg/bgp/api/conversions.go:55

		return nil, fmt.Errorf("unknown AFI %s", params.Afi)
	}

	if ret.Family.Safi = types.ParseSafi(params.Safi); ret.Family.Safi == types.SafiUnknown {
		return nil, fmt.Errorf("unknown SAFI %s", params.Safi)
	}

	if params.Neighbor != nil {
		if ret.TableType == types.TableTypeLocRIB {
			return nil, fmt.Errorf("neighbor is unnecessary for loc-rib table type")
		}
		addr, err := netip.ParseAddr(*params.Neighbor)
		if err != nil {
			return nil, fmt.Errorf("invalid neighbor address: %w", err)
		}
		ret.Neighbor = addr
	} else {
		if ret.TableType == types.TableTypeAdjRIBIn || ret.TableType == types.TableTypeAdjRIBOut {
			return nil, fmt.Errorf("table %s requires neighbor parameter", params.TableType)
		}
	}

	return ret, nil
}

func ToAPIFamily(f *types.Family) (*models.BgpFamily, error) {
	return &models.BgpFamily{
		Afi:  f.Afi.String(),
		Safi: f.Safi.String(),
	}, nil
}

func ToAPIFamilies(families []types.Family) []*models.BgpFamily {
	var res []*models.BgpFamily
	for _, f := range families {
		if family, err := ToAPIFamily(&f); err == nil {
			res = append(res, family)

View on GitHub (pinned to ac7b90affa)

Solutions

  1. Add the neighbor query parameter with the peer's IP address, e.g. neighbor=10.0.0.1.
  2. If you want all routes regardless of peer, query table=loc-rib instead, which requires no neighbor.
  3. Validate the request in client code before issuing it: adj-rib-* requires neighbor, loc-rib forbids it.

Example fix

// before
curl '.../bgp/routes?table=adj-rib-in&afi=ipv4&safi=unicast'
// after
curl '.../bgp/routes?table=adj-rib-in&afi=ipv4&safi=unicast&neighbor=10.0.0.1'
Defensive patterns

Strategy: validation

Validate before calling

// Go: require neighbor for adj-rib tables
func requiresNeighbor(table string) bool {
	return table == "adj-rib-in" || table == "adj-rib-out"
}
// before calling:
// if requiresNeighbor(table) && neighbor == "" { return errors.New("neighbor required for " + table) }

Try / catch

req, err := bgpapi.ToAgentGetRoutesRequest(params)
if err != nil {
	if strings.Contains(err.Error(), "requires neighbor parameter") {
		return api.Error(http.StatusBadRequest, fmt.Errorf("table %s requires a neighbor query parameter", params.TableType))
	}
	return api.Error(http.StatusInternalServerError, err)
}

Prevention

When it happens

Trigger: Calling GetBgpRoutes with table=adj-rib-in or table=adj-rib-out and omitting the neighbor query parameter.

Common situations: Querying per-peer RIBs without knowing a neighbor filter is required; switching a loc-rib query (no neighbor needed) to an adj-rib table without adding the parameter.

Understand the failure class

Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.

Related errors


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