[CRITICAL] Exception: SQLSTATE[22007]: Invalid datetime format / Error discovering fdb-table

Hey,

Does anyone know how to fix this? It started out of the blue some time ago. I’m seeing it nealy all devices.

2026-02-05 00:37:29 discovery asw0.b5 Error discovering fdb-table module. Check log file for more details. System

Here is /opt/librenms/logs/librenms.log

[2026-02-06T12:34:02][CRITICAL] Exception: Illuminate\Database\QueryException SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: '' for column `librenms`.`ports_fdb`.`port_id` at row 1 (Connection: mysql, Host: localhost, Port: 3306, Database: librenms, SQL: insert into `ports_fdb` (`port_id`, `mac_address`, `vlan_id`, `device_id`, `created_at`, `updated_at`) values (, 000af77f297c, 1927, 3, 2026-02-06 12:34:02, 2026-02-06 12:34:02)) @ /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Connection.php:838
#0 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Connection.php(794): Illuminate\Database\Connection->runQueryCallback()
#1 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/MySqlConnection.php(42): Illuminate\Database\Connection->run()
#2 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(4002): Illuminate\Database\MySqlConnection->insert()
#3 /opt/librenms/includes/discovery/fdb-table.inc.php(68): Illuminate\Database\Query\Builder->insert()
#4 /opt/librenms/LibreNMS/Modules/LegacyModule.php(84): include('...')
#5 /opt/librenms/app/Jobs/DiscoverDevice.php(130): LibreNMS\Modules\LegacyModule->discover()
#6 /opt/librenms/app/Jobs/DiscoverDevice.php(55): App\Jobs\DiscoverDevice->discoverModules()
#7 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\Jobs\DiscoverDevice->handle()
#8 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/Util.php(43): Illuminate\Container\BoundMethod::{closure:Illuminate\Container\BoundMethod::call():35}()
#9 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(96): Illuminate\Container\Util::unwrapIfClosure()
#10 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\Container\BoundMethod::callBoundMethod()
#11 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/Container.php(799): Illuminate\Container\BoundMethod::call()
#12 /opt/librenms/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(129): Illuminate\Container\Container->call()
#13 /opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Bus\Dispatcher->{closure:Illuminate\Bus\Dispatcher::dispatchNow():126}()
#14 /opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(137): Illuminate\Pipeline\Pipeline->{closure:Illuminate\Pipeline\Pipeline::prepareDestination():178}()
#15 /opt/librenms/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(133): Illuminate\Pipeline\Pipeline->then()
#16 /opt/librenms/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(134): Illuminate\Bus\Dispatcher->dispatchNow()
#17 /opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Queue\CallQueuedHandler->{closure:Illuminate\Queue\CallQueuedHandler::dispatchThroughMiddleware():127}()
#18 /opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(137): Illuminate\Pipeline\Pipeline->{closure:Illuminate\Pipeline\Pipeline::prepareDestination():178}()
#19 /opt/librenms/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(127): Illuminate\Pipeline\Pipeline->then()
#20 /opt/librenms/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(68): Illuminate\Queue\CallQueuedHandler->dispatchThroughMiddleware()
#21 /opt/librenms/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(102): Illuminate\Queue\CallQueuedHandler->call()
#22 /opt/librenms/vendor/laravel/framework/src/Illuminate/Queue/SyncQueue.php(131): Illuminate\Queue\Jobs\Job->fire()
#23 /opt/librenms/vendor/laravel/framework/src/Illuminate/Queue/SyncQueue.php(111): Illuminate\Queue\SyncQueue->executeJob()
#24 /opt/librenms/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(246): Illuminate\Queue\SyncQueue->push()
#25 /opt/librenms/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(230): Illuminate\Bus\Dispatcher->pushCommandToQueue()
#26 /opt/librenms/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(98): Illuminate\Bus\Dispatcher->dispatchToQueue()
#27 /opt/librenms/app/PerDeviceProcess.php(78): Illuminate\Bus\Dispatcher->dispatchSync()
#28 /opt/librenms/app/Console/Commands/DeviceDiscover.php(76): App\PerDeviceProcess->run()
#29 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\Console\Commands\DeviceDiscover->handle()
#30 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/Util.php(43): Illuminate\Container\BoundMethod::{closure:Illuminate\Container\BoundMethod::call():35}()
#31 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(96): Illuminate\Container\Util::unwrapIfClosure()
#32 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\Container\BoundMethod::callBoundMethod()
#33 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/Container.php(799): Illuminate\Container\BoundMethod::call()
#34 /opt/librenms/vendor/laravel/framework/src/Illuminate/Console/Command.php(211): Illuminate\Container\Container->call()
#35 /opt/librenms/vendor/symfony/console/Command/Command.php(341): Illuminate\Console\Command->execute()
#36 /opt/librenms/vendor/laravel/framework/src/Illuminate/Console/Command.php(180): Symfony\Component\Console\Command\Command->run()
#37 /opt/librenms/vendor/symfony/console/Application.php(1102): Illuminate\Console\Command->run()
#38 /opt/librenms/vendor/symfony/console/Application.php(356): Symfony\Component\Console\Application->doRunCommand()
#39 /opt/librenms/vendor/symfony/console/Application.php(195): Symfony\Component\Console\Application->doRun()
#40 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(198): Symfony\Component\Console\Application->run()
#41 /opt/librenms/lnms(35): Illuminate\Foundation\Console\Kernel->handle()
#42 {main}

Here is validate

librenms@librenms:~$ ./validate.php
===========================================
Component | Version
--------- | -------
LibreNMS  | 26.2.0-dev.152+a105842c6 (2026-02-05T18:16:27+00:00)
DB Schema | 2026_01_18_221501_cefpunt2host_changes (364)
PHP       | 8.4.10
Python    | 3.10.12
Database  | MariaDB 10.6.22-MariaDB-0ubuntu0.22.04.1
RRDTool   | 1.7.2
SNMP      | 5.9.1
===========================================

[OK]    Composer Version: 2.9.5
[OK]    Dependencies up-to-date.
[OK]    Database Connected
[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 and column collations are correct
[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
[OK]    Redis is unavailable
[OK]    rrd_dir is writable
[OK]    rrdtool version ok

Thanks for any suggestions.

I’m seeing the same on my test system. Interesting enough, the code seems to suggest that ‘’ is a valid value, although it’s an integer field for years.

Further, port_id can’t be NULL. So it seems like those records should get logged and dropped.

However, it’s not clear if those are valid records that failed to get a valid port_id or invalid records that can just get dropped

Sorry, old code was hiding a lot of errors. Now they are exposed a little more visibly. Any helping fixing them is appreciated (including reporting them).

I patched it on my test system and it looks like all the MACs with missing ports are from SVI interfaces on cisco switches. Although the VLAN it’s giving for them is wrong. The MACs are in librenms with the correct interface so it seems safe to skip them for now.

Note: all switches are running CAT9K_IOSXE 17.9.4a

Open PR: FDB: skip entries if port_id is null by shrank · Pull Request #19004 · librenms/librenms · GitHub

Running into the same situation with Nexus9K running NX-OS 9.x. FDB is not populating in LibreNMS 26.1.1. NX-OS 9.x has some icky SNMP bugs, so I’m not too concerned. 10.x seems to be working. We’re upgrading the remaining switches in our fleet to 10.x soon and will chime in if the problem persists.