production.ERROR: SQLSTATE[42000]: Syntax error or access violation: 1065 Query was empty (SQL: ) (SQL: )

====================================

Component Version
LibreNMS 1.48.1-70-g2eac72d
DB Schema 2019_01_16_195644_add_vrf_id_and_bgpLocalAs (131)
PHP 7.2.15
MySQL 5.5.56-MariaDB
RRDTool 1.6.0
SNMP NET-SNMP 5.7.2

====================================

[OK] Composer Version: 1.8.4
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct

I have many errors of this kind in librenms.log

[2019-02-19 08:42:07] production.ERROR: SQLSTATE[42000]: Syntax error or access violation: 1065 Query was empty (SQL: ) (SQL: )
/opt/librenms/includes/alerts.inc.php:186
/opt/librenms/poller.php:162
/opt/librenms/poller.php 82 2019-02-19 08:42:07 - 1 devices polled in 4.132 secs
[2019-02-19 08:42:08] production.ERROR: SQLSTATE[42000]: Syntax error or access violation: 1065 Query was empty (SQL: ) (SQL: )
/opt/librenms/includes/alerts.inc.php:186
/opt/librenms/poller.php:162
/opt/librenms/poller.php 1 2019-02-19 08:42:08 - 1 devices polled in 4.317 secs
[2019-02-19 08:42:08] production.ERROR: SQLSTATE[42000]: Syntax error or access violation: 1065 Query was empty (SQL: ) (SQL: )
/opt/librenms/includes/alerts.inc.php:186
/opt/librenms/poller.php:162

That looks like you have an invalid aler rule. Check them

I had a bad alert rule
%macros.port_usage_perc >= “80” && %port.port_descr_type != “client” && %ports.ifType != “softwareLoopback” && %ports.ifType != “ppp”

should be %ports.port… and ports.ifType

Now I have some other error

production.ERROR: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘445-26777’ for key ‘device_ifIndex’ (SQL: UPDATE ports set ifIndex=26777,poll_time=1550566518,poll_prev=1515755716,poll_period=34810802,ifLastChange=366517966,ifOperStatus=up,`

I’ve changed the device port association to ‘ifIndex’, works.