Get The Most Affordable Hosting in the World!
Starting at just $1.87/month, Vercaa offers unbeatable pricing for world-class web hosting services.
Fast, reliable, and secure hosting to power your website without breaking the bank. Plus, enjoy a free CDN for faster loading times worldwide!
Get Started Now!Symptom
Performing an action that creates an invoice (including the daily automation cron tasks or when your staff or a client places an order) you may observe an Oops! Integrity constraint violation
error message.
The full error is:
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.
To assign a custom invoice numbering format, see Configuring a Custom Invoice Number Format.
Solution
1. Using a tool like phpMyAdmin, perform the following query against WHMCS's MySQL database and note the result:
SELECT MAX(invoiceid) + 1 FROM tblinvoiceitems;
![MySQL Reuslt showing a value of 4](https://media.screensteps.com/image_assets/assets/006/937/197/original/640b9e9f-4354-4f65-8221-a24e6e4c2e0c.png)
2. Log in to the WHMCS Admin Area.
3. Go to the Invoices tab at Configuration > System Settings > General Settings.
4. Enter the value that you noted in step 1 for Invoice Starting #.
5. Click Save Changes.
Invoice Starting # will be empty after saving. This is normal.
The End! should you have any inquiries, we encourage you to reach out to the Vercaa Support Center without hesitation.