Hello
got a sql error in centreon-web.log when trying to add CMA agents :

in logs :
[2026-06-18T11:40:32+0200] [ERROR] Rollback of 'AddAgentConfiguration' transaction. {"custom":null,"exception":null,"default":{"request_infos":{"uri":"/centreon/api/latest/configuration/agent-configurations","http_method":"POST","server":"supervision.admdom.tld"}}}
[2026-06-18T11:40:32+0200] [ERROR] Error while adding broker directive in agent configuration {"custom":{"user_id":21,"ac_type":"centreon-agent","ac_name":"CMA"},"exception":{"type":"Core\\Common\\Domain\\Exception\\RepositoryException","message":"Error while adding broker directive in agent configuration","previous_type":"Adaptation\\Database\\Connection\\Exception\\ConnectionException","previous_message":"Error while execut
ing the insert query : Error while executing the statement : An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`centreon`.`cfg_nagios_broker_module`, CONSTRAINT `fk_nagios_cfg` FOREIGN KEY (`cfg_nagios_id`) REFERENCES `cfg_nagios` (`nagios_id`) ON DELETE CASCADE)","trace":"#0 /usr/share/centreon/src/Core/AgentC
onfiguration/Application/UseCase/AddAgentConfiguration/AddAgentConfiguration.php(163): Core\\AgentConfiguration\\Infrastructure\\Repository\\DbWriteAgentConfigurationRepository->addBrokerDirective()\n#1 /usr/share/centreon/src/Core/AgentConfiguration/Application/UseCase/AddAgentConfiguration/AddAgentConfiguration.php(97): Core\\AgentConfiguration\\Application\\UseCase\\AddAgentConfiguration\\AddAgentConfiguration->save()\n#2
/usr/share/centreon/src/Core/AgentConfiguration/Infrastructure/API/AddAgentConfiguration/AddAgentConfigurationController.php(49): Core\\AgentConfiguration\\Application\\UseCase\\AddAgentConfiguration\\AddAgentConfiguration->__invoke()\n#3 /usr/share/centreon/vendor/symfony/http-kernel/HttpKernel.php(181): Core\\AgentConfiguration\\Infrastructure\\API\\AddAgentConfiguration\\AddAgentConfigurationController->__invoke()\n#4 /usr
/share/centreon/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\\Component\\HttpKernel\\HttpKernel->handleRaw()\n#5 /usr/share/centreon/vendor/symfony/http-kernel/Kernel.php(197): Symfony\\Component\\HttpKernel\\HttpKernel->handle()\n#6 /usr/share/centreon/api/index.php(47): Symfony\\Component\\HttpKernel\\Kernel->handle()\n#7 {main}"},"default":{"request_infos":{"uri":"/centreon/api/latest/configuration/agent-configur
ations","http_method":"POST","server":"supervision.dom.tld"}}}
[2026-06-18T11:40:32+0200] [DEBUG] Data error. Generating an error response {"custom":null,"exception":null,"default":{"request_infos":{"uri":"/centreon/api/latest/configuration/agent-configurations","http_method":"POST","server":"supervision.dom.tld"}}}
it may be related to nagios_server.id not corresponding to cfg_nagios.nagios_id :
MariaDB [centreon]> SELECT nagios_id, nagios_name, nagios_server_id
-> FROM cfg_nagios;
+-----------+-------------------------+------------------+
| nagios_id | nagios_name | nagios_server_id |
+-----------+-------------------------+------------------+
| 1 | Centreon Engine Central | 1 |
| 2 | Centreon Engine CFG 1 | 1 |
| 3 | centreon-poller1-hits | 2 |
| 5 | centreon-poller1-pa3 | 4 |
| 7 | centreon-poller1-pa2 | 6 |
| 10 | centreon-poller1-ren | 9 |
+-----------+-------------------------+------------------+
6 rows in set (0.001 sec)
MariaDB [centreon]>
MariaDB [centreon]> SELECT id, name
-> FROM nagios_server;
+----+-----------------------+
| id | name |
+----+-----------------------+
| 1 | Central |
| 2 | centreon-poller1-hits |
| 4 | centreon-poller1-pa3 |
| 6 | centreon-poller1-pa2 |
| 9 | centreon-poller1-ren |
+----+-----------------------+
5 rows in set (0.001 sec)
what should I do ? I’m running latest 24.10 / debian 12
Regards
Cédric
