BGP peering issue/duplicate peers

I’m noticing a issue with BGP monitoring and Huawei switches.
LibreNMS keeps adding duplicates of the same peerings …
We have around 40 real peerings in the switches but LibreNMS reports that we have over 1000 peerings…

This started with the newest version of LibreNMS


Component Version
LibreNMS 22.8.0-102-gfd6fdeeb5
DB Schema 2022_09_03_091314_update_ports_adsl_table_with_defaults (246)
PHP 8.1.10
Python 3.9.7
Database MariaDB 10.5.16-MariaDB
RRDTool 1.7.0
SNMP 5.8


[OK] Composer Version: 2.4.2
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database Schema is current
[OK] SQL Server meets minimum requirements
[OK] lower_case_table_names is enabled
[OK] MySQL engine is optimal
[OK] Database schema correct
[OK] MySQl and PHP time match
[OK] Active pollers found
[OK] Dispatcher Service not detected
[OK] Locks are functional
[OK] Python poller wrapper is polling
[WARN] Using database for locking, you should set CACHE_DRIVER=redis
[OK] rrdtool version ok
[OK] Connected to rrdcached

And an update on this…
I noticed that while running discovery I get an error like this:

Load disco module bgp-peers

SQLSTATE[HY093]: Invalid parameter number (SQL: SELECT COUNT() from bgpPeers WHERE device_id = 900 AND bgpPeerIdentifier = AND vrf_id IS NU LL ) (SQL: SELECT COUNT() from bgpPeers WHERE device_id = 900 AND bgpPeerIden tifier = AND vrf_id IS NULL )#0 /opt/librenms/includes/discove ry/bgp-peers/ dbFetchCell()
#1 /opt/librenms/includes/discovery/ include(’…’)
#2 /opt/librenms/includes/discovery/ include(’…’)
#3 /opt/librenms/discovery.php(118): discover_device()
#4 {main}