{"record":{"id":"38a98670fa08fa56","repo":"cilium/cilium","slug":"table-s-requires-neighbor-parameter","errorCode":null,"errorMessage":"table %s requires neighbor parameter","messagePattern":"table (.+?) requires neighbor parameter","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/bgp/api/conversions.go","lineNumber":55,"sourceCode":"\t\treturn nil, fmt.Errorf(\"unknown AFI %s\", params.Afi)\n\t}\n\n\tif ret.Family.Safi = types.ParseSafi(params.Safi); ret.Family.Safi == types.SafiUnknown {\n\t\treturn nil, fmt.Errorf(\"unknown SAFI %s\", params.Safi)\n\t}\n\n\tif params.Neighbor != nil {\n\t\tif ret.TableType == types.TableTypeLocRIB {\n\t\t\treturn nil, fmt.Errorf(\"neighbor is unnecessary for loc-rib table type\")\n\t\t}\n\t\taddr, err := netip.ParseAddr(*params.Neighbor)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid neighbor address: %w\", err)\n\t\t}\n\t\tret.Neighbor = addr\n\t} else {\n\t\tif ret.TableType == types.TableTypeAdjRIBIn || ret.TableType == types.TableTypeAdjRIBOut {\n\t\t\treturn nil, fmt.Errorf(\"table %s requires neighbor parameter\", params.TableType)\n\t\t}\n\t}\n\n\treturn ret, nil\n}\n\nfunc ToAPIFamily(f *types.Family) (*models.BgpFamily, error) {\n\treturn &models.BgpFamily{\n\t\tAfi:  f.Afi.String(),\n\t\tSafi: f.Safi.String(),\n\t}, nil\n}\n\nfunc ToAPIFamilies(families []types.Family) []*models.BgpFamily {\n\tvar res []*models.BgpFamily\n\tfor _, f := range families {\n\t\tif family, err := ToAPIFamily(&f); err == nil {\n\t\t\tres = append(res, family)","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/cilium/cilium/blob/ac7b90affa4baf0642e6685319d56907b3a73a6d/pkg/bgp/api/conversions.go#L37-L73","documentation":"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.","triggerScenarios":"Calling GetBgpRoutes with table=adj-rib-in or table=adj-rib-out and omitting the neighbor query parameter.","commonSituations":"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.","solutions":["Add the neighbor query parameter with the peer's IP address, e.g. neighbor=10.0.0.1.","If you want all routes regardless of peer, query table=loc-rib instead, which requires no neighbor.","Validate the request in client code before issuing it: adj-rib-* requires neighbor, loc-rib forbids it."],"exampleFix":"// before\ncurl '.../bgp/routes?table=adj-rib-in&afi=ipv4&safi=unicast'\n// after\ncurl '.../bgp/routes?table=adj-rib-in&afi=ipv4&safi=unicast&neighbor=10.0.0.1'","handlingStrategy":"validation","validationCode":"// Go: require neighbor for adj-rib tables\nfunc requiresNeighbor(table string) bool {\n\treturn table == \"adj-rib-in\" || table == \"adj-rib-out\"\n}\n// before calling:\n// if requiresNeighbor(table) && neighbor == \"\" { return errors.New(\"neighbor required for \" + table) }","typeGuard":null,"tryCatchPattern":"req, err := bgpapi.ToAgentGetRoutesRequest(params)\nif err != nil {\n\tif strings.Contains(err.Error(), \"requires neighbor parameter\") {\n\t\treturn api.Error(http.StatusBadRequest, fmt.Errorf(\"table %s requires a neighbor query parameter\", params.TableType))\n\t}\n\treturn api.Error(http.StatusInternalServerError, err)\n}","preventionTips":["Remember: adj-rib-in/adj-rib-out need neighbor; loc-rib forbids it.","Centralize request validation in one client helper.","Surface the rule in client-side error messages so users correct queries quickly."],"tags":["bgp","validation","http-api","parameters"],"backgroundTag":"missing-required-parameter","analyzedSha":"ac7b90affa4baf0642e6685319d56907b3a73a6d","analyzedAt":"2026-08-31T18:27:15.868Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}