Skip to content

Dreaded Integrity constraint violation when completing sales orders

I’ve read tons of forum posts on this topic, but they all seem to be specific to the module or process and I can’t find this one. How would I go about trouble-shooting and fixing this?

Here is the full error:

PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (bitnami_magento.sales_invoice, CONSTRAINT SALES_INVOICE_ORDER_ID_SALES_ORDER_ENTITY_ID FOREIGN KEY (order_id) REFERENCES sales_order (entity_id) ON DELETE CASCADE) at /bitnami/magento/vendor/magento/framework/DB/Statement/Pdo/Mysql.php:90