Problem
While performing an action that creates an invoice (including the daily automation cron tasks or when your staff or a client places an order), you see the following Oops!
error message:
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '2147483647' for key 'tblinvoices.PRIMARY' in /path/to/whmcs/vendor/illuminate/database/Connection.php:464
Cause
The Invoice Starting # setting is an integer value that is larger than 2,147,483,648
(2 billion 100 thousand), which is higher than MySQL® can accommodate.
Solution
Using a tool like phpMyAdmin, run the following query against WHMCS’s MySQL database and note the result:
SELECT MAX(invoiceid) + 1 FROM tblinvoiceitems;
Log in to the WHMCS Admin Area.
Go to the Invoices tab at Configuration () > System Settings > General Settings.
Enter the value that you noted in step 1 for Invoice Starting #.
Click Save Changes.
Invoice Starting # will be empty after saving. This is normal.
Last modified: November 19, 2024