cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot save shipment error

Cannot save shipment error

Hello,

Thank you for always help me a lot.

 

I have a problem when I submit shipment from admin.

I checked exception.log and the following is the error log.

How can I fix it?

 

2016-07-18T13:11:08+00:00 ERR (3):
exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '400000001' for key 'UNQ_SALES_FLAT_SHIPMENT_INCREMENT_ID'' in /mydomain.com/lib/Zend/Db/Statement/Pdo.php:228
Stack trace:
/mydomain.com/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
/mydomain.com/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
/mydomain.com/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
/mydomain.com/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
/mydomain.com/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `sa...', Array)
/mydomain.com/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `sa...', Array)
/mydomain.com/lib/Zend/Db/Adapter/Abstract.php(576): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `sa...', Array)
/mydomain.com/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(453): Zend_Db_Adapter_Abstract->insert('sales_flat_ship...', Array)
/mydomain.com/app/code/core/Mage/Sales/Model/Resource/Order/Abstract.php(425): Mage_Core_Model_Resource_Db_Abstract->save(Object(Mage_Sales_Model_Order_Shipment))
/mydomain.com/app/code/core/Mage/Core/Model/Abstract.php(318): Mage_Sales_Model_Resource_Order_Abstract->save(Object(Mage_Sales_Model_Order_Shipment))
/mydomain.com/app/code/core/Mage/Core/Model/Resource/Transaction.php(151): Mage_Core_Model_Abstract->save()
/mydomain.com/app/code/core/Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php(120): Mage_Core_Model_Resource_Transaction->save()
/mydomain.com/app/code/core/Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php(220): Mage_Adminhtml_Sales_Order_ShipmentController->_saveShipment(Object(Mage_Sales_Model_Order_Shipment))
/mydomain.com/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Adminhtml_Sales_Order_ShipmentController->saveAction()
/mydomain.com/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('save')
/mydomain.com/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
/mydomain.com/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
/mydomain.com/app/Mage.php(684): Mage_Core_Model_App->run(Array)
/mydomain.com/index.php(87): Mage::run('', 'store')
{main}

Next exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '400000001' for key 'UNQ_SALES_FLAT_SHIPMENT_INCREMENT_ID', query was: INSERT INTO `sales_flat_shipment` (`store_id`, `total_qty`, `email_sent`, `order_id`, `customer_id`, `shipping_address_id`, `billing_address_id`, `increment_id`, `created_at`, `updated_at`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, '2016-07-18 13:11:08', '2016-07-18 13:11:08')' in /mydomain.com/lib/Zend/Db/Statement/Pdo.php:235
Stack trace:
/mydomain.com/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
/mydomain.com/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
/mydomain.com/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
/mydomain.com/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `sa...', Array)
/mydomain.com/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `sa...', Array)
/mydomain.com/lib/Zend/Db/Adapter/Abstract.php(576): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `sa...', Array)
/mydomain.com/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(453): Zend_Db_Adapter_Abstract->insert('sales_flat_ship...', Array)
/mydomain.com/app/code/core/Mage/Sales/Model/Resource/Order/Abstract.php(425): Mage_Core_Model_Resource_Db_Abstract->save(Object(Mage_Sales_Model_Order_Shipment))
/mydomain.com/app/code/core/Mage/Core/Model/Abstract.php(318): Mage_Sales_Model_Resource_Order_Abstract->save(Object(Mage_Sales_Model_Order_Shipment))
/mydomain.com/app/code/core/Mage/Core/Model/Resource/Transaction.php(151): Mage_Core_Model_Abstract->save()
/mydomain.com/app/code/core/Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php(120): Mage_Core_Model_Resource_Transaction->save()
/mydomain.com/app/code/core/Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php(220): Mage_Adminhtml_Sales_Order_ShipmentController->_saveShipment(Object(Mage_Sales_Model_Order_Shipment))
/mydomain.com/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Adminhtml_Sales_Order_ShipmentController->saveAction()
/mydomain.com/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('save')
/mydomain.com/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
/mydomain.com/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
/mydomain.com/app/Mage.php(684): Mage_Core_Model_App->run(Array)
/mydomain.com/index.php(87): Mage::run('', 'store')
{main}

6 REPLIES 6

Re: Cannot save shipment error

It is because it try to add the same primary key entry in the 'UNQ_SALES_FLAT_SHIPMENT_INCREMENT_ID'. Have you customize the code or its default magento.

 

Also provide the details wich magento version you are using.

 

Re: Cannot save shipment error

Hello, padmaniyogesh.

 

Thank you for your answer.

I have not customized the code nor edited any magento's core files.

My theme also haven't changed core files.

I am using Magento ver. 1.9.1.0.

And about shipping extension, I installed the following.

https://www.magentocommerce.com/magento-connect/webshopapps-matrixrate-1-multiple-table-rates-extens...

How should I fix it?

 

Re: Cannot save shipment error

You can contact this extension support. if they will not resolve this issue then you can disable this extention and check is default magento working in your envirnment or not.

Re: Cannot save shipment error

Thank you for your answer.

 

I uninstalled the shipping extension and tried "submit shipment" in admin. But the same error "Cannot save shipment" displayed.

And moreover I found another error saying "Unable to save the invoice" when I try "submit invoice". The error occurs only when I submit invoice with the shipping information by creating shipment.

 

It is strange that when I try submit shipment for the theme's original test data, the error doesn't occur.

Recent change in my site is uninstalling minify extension that broke my site, but I reinstalled backup of my magento file without that extension. Another thing I did is enabled paypal.

The following is the another error log of "Unable to save the invoice" in exception.log;

 

2016-07-20T13:01:30+00:00 ERR (3):
exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '400000001' for key 'UNQ_SALES_FLAT_SHIPMENT_INCREMENT_ID'' in /mydomain/lib/Zend/Db/Statement/Pdo.php:228
Stack trace:
/mydomain/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
/mydomain/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
/mydomain/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
/mydomain/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
/mydomain/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `sa...', Array)
/mydomain/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `sa...', Array)
/mydomain/lib/Zend/Db/Adapter/Abstract.php(576): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `sa...', Array)
/mydomain/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(453): Zend_Db_Adapter_Abstract->insert('sales_flat_ship...', Array)
/mydomain/app/code/core/Mage/Sales/Model/Resource/Order/Abstract.php(425): Mage_Core_Model_Resource_Db_Abstract->save(Object(Mage_Sales_Model_Order_Shipment))
/mydomain/app/code/core/Mage/Core/Model/Abstract.php(318): Mage_Sales_Model_Resource_Order_Abstract->save(Object(Mage_Sales_Model_Order_Shipment))
/mydomain/app/code/core/Mage/Core/Model/Resource/Transaction.php(151): Mage_Core_Model_Abstract->save()
/mydomain/app/code/core/Mage/Adminhtml/controllers/Sales/Order/InvoiceController.php(272): Mage_Core_Model_Resource_Transaction->save()
/mydomain/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Adminhtml_Sales_Order_InvoiceController->saveAction()
/mydomain/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('save')
/mydomain/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
/mydomain/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
/mydomain/app/Mage.php(684): Mage_Core_Model_App->run(Array)
/mydomain/index.php(87): Mage::run('', 'store')
{main}

Next exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '400000001' for key 'UNQ_SALES_FLAT_SHIPMENT_INCREMENT_ID', query was: INSERT INTO `sales_flat_shipment` (`store_id`, `total_qty`, `email_sent`, `order_id`, `customer_id`, `shipping_address_id`, `billing_address_id`, `increment_id`, `created_at`, `updated_at`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, '2016-07-20 13:01:30', '2016-07-20 13:01:30')' in /mydomain/lib/Zend/Db/Statement/Pdo.php:235
Stack trace:
/mydomain/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
/mydomain/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
/mydomain/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
/mydomain/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `sa...', Array)
/mydomain/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `sa...', Array)
/mydomain/lib/Zend/Db/Adapter/Abstract.php(576): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `sa...', Array)
/mydomain/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(453): Zend_Db_Adapter_Abstract->insert('sales_flat_ship...', Array)
/mydomain/app/code/core/Mage/Sales/Model/Resource/Order/Abstract.php(425): Mage_Core_Model_Resource_Db_Abstract->save(Object(Mage_Sales_Model_Order_Shipment))
/mydomain/app/code/core/Mage/Core/Model/Abstract.php(318): Mage_Sales_Model_Resource_Order_Abstract->save(Object(Mage_Sales_Model_Order_Shipment))
/mydomain/app/code/core/Mage/Core/Model/Resource/Transaction.php(151): Mage_Core_Model_Abstract->save()
/mydomain/app/code/core/Mage/Adminhtml/controllers/Sales/Order/InvoiceController.php(272): Mage_Core_Model_Resource_Transaction->save()
/mydomain/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Adminhtml_Sales_Order_InvoiceController->saveAction()
/mydomain/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('save')
/mydomain/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
/mydomain/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
/mydomain/app/Mage.php(684): Mage_Core_Model_App->run(Array)
/mydomain/index.php(87): Mage::run('', 'store')
{main}

Re: Cannot save shipment error

Thank you, padmaniyogesh.

 

I found the solution by searching the web again.

http://magento.stackexchange.com/questions/31262/cannot-save-shipment-error-with-non-sample-orders-1...

and followed the "UPDATE 4: FOUND THE SOLUTION".

 

I edited database and could save shipment and invoice.

 

Thank you very much.

 

 

Re: Cannot save shipment error

You are welcome. Can you please accept the solution and marked this as solved and also provide some kudos.