Here is the output, seems no hostID=0 record. I de-registered and re-registered, same error message. I also reinstalled the Ubuntu & fog server, the result is same.
mysql> select * from hosts;
+--------+--------------+--------------------------------------------------+--------+-----------+--------------+---------------------+---------------------+--------------+-----------+--------------+----------+------------+------------+------------------+----------------+------------------+----------------+------------+------------+----------+-------------+------------+--------------+---------------------+--------------+--------------+-------------+-------------+
| hostID | hostName | hostDesc | hostIP | hostImage | hostBuilding | hostCreateDate | hostLastDeploy | hostCreateBy | hostUseAD | hostADDomain | hostADOU | hostADUser | hostADPass | hostADPassLegacy | hostProductKey | hostPrinterLevel | hostKernelArgs | hostKernel | hostDevice | hostInit | hostPending | hostPubKey | hostSecToken | hostSecTime | hostPingCode | hostExitBios | hostExitEfi | hostEnforce |
+--------+--------------+--------------------------------------------------+--------+-----------+--------------+---------------------+---------------------+--------------+-----------+--------------+----------+------------+------------+------------------+----------------+------------------+----------------+------------+------------+----------+-------------+------------+--------------+---------------------+--------------+--------------+-------------+-------------+
| 1 | 00e04c6939cd | Created by FOG Reg on December 13, 2016, 5:00 am | | 0 | 0 | 2016-12-13 05:00:40 | 0000-00-00 00:00:00 | fog | | | | | | | | | | | | | | | | 0000-00-00 00:00:00 | | | | |
+--------+--------------+--------------------------------------------------+--------+-----------+--------------+---------------------+---------------------+--------------+-----------+--------------+----------+------------+------------+------------------+----------------+------------------+----------------+------------+------------+----------+-------------+------------+--------------+---------------------+--------------+--------------+-------------+-------------+
1 row in set (0.00 sec)
mysql>
mysql> DELETE FROM `hosts` WHERE `hostID` = '0';
Query OK, 0 rows affected (0.00 sec)
mysql> DELETE FROM `hostMAC` WHERE hmID = '0' OR `hmHostID` = '0';
Query OK, 0 rows affected (0.00 sec)
mysql> DELETE FROM `groupMembers` WHERE `gmID` = '0' OR `gmHostID` = '0' OR `gmGroupID` = '0';
Query OK, 0 rows affected (0.00 sec)
mysql> DELETE FROM `snapinGroupAssoc` WHERE `sgaID` = '0' OR `sgaSnapinID` = '0' OR `sgaStorageGroupID` = '0';
Query OK, 0 rows affected (0.00 sec)
mysql> DELETE from `snapinAssoc` WHERE `saID` = '0' OR `saHostID` = '0' OR `saSnapinID` = '0';
Query OK, 0 rows affected (0.00 sec)
mysql> DELETE FROM `hosts` WHERE `hostID` NOT IN (SELECT `hmHostID` FROM `hostMAC`);
Query OK, 0 rows affected (0.00 sec)
mysql> DELETE FROM `hostMAC` WHERE `hmhostID` NOT IN (SELECT `hostID` FROM `hosts`);
Query OK, 0 rows affected (0.00 sec)
mysql> DELETE FROM `snapinAssoc` WHERE `saHostID` NOT IN (SELECT `hostID` FROM `hosts`);
Query OK, 0 rows affected (0.00 sec)
mysql> DELETE FROM `groupMembers` WHERE `gmHostID` NOT IN (SELECT `hostID` FROM `hosts`);
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye