Hi, I cannot create any product from admin panel. when I try to save I get "Unable to save Stock Item" error message.
This happened after I execute below SQL query. Please help me to fix this.
SET FOREIGN_KEY_CHECKS = 0; TRUNCATE TABLE `catalog_category_product`; TRUNCATE TABLE `catalog_category_product_index`; TRUNCATE TABLE `catalog_category_product_index_tmp`; TRUNCATE TABLE `catalog_compare_item`; TRUNCATE TABLE `catalog_product_bundle_option`; TRUNCATE TABLE `catalog_product_bundle_option_value`; TRUNCATE TABLE `catalog_product_bundle_price_index`; TRUNCATE TABLE `catalog_product_bundle_selection`; TRUNCATE TABLE `catalog_product_bundle_selection_price`; TRUNCATE TABLE `catalog_product_bundle_stock_index`; TRUNCATE TABLE `catalog_product_entity`; TRUNCATE TABLE `catalog_product_entity_datetime`; TRUNCATE TABLE `catalog_product_entity_decimal`; TRUNCATE TABLE `catalog_product_entity_gallery`; TRUNCATE TABLE `catalog_product_entity_int`; TRUNCATE TABLE `catalog_product_entity_media_gallery`; TRUNCATE TABLE `catalog_product_entity_media_gallery_value`; TRUNCATE TABLE `catalog_product_entity_media_gallery_value_to_entity`; TRUNCATE TABLE `catalog_product_entity_media_gallery_value_video`; TRUNCATE TABLE `catalog_product_entity_text`; TRUNCATE TABLE `catalog_product_entity_tier_price`; TRUNCATE TABLE `catalog_product_entity_varchar`; TRUNCATE TABLE `catalog_product_index_eav`; TRUNCATE TABLE `catalog_product_index_eav_decimal`; TRUNCATE TABLE `catalog_product_index_eav_decimal_idx`; TRUNCATE TABLE `catalog_product_index_eav_decimal_tmp`; TRUNCATE TABLE `catalog_product_index_eav_idx`; TRUNCATE TABLE `catalog_product_index_eav_tmp`; TRUNCATE TABLE `catalog_product_index_price`; TRUNCATE TABLE `catalog_product_index_price_bundle_idx`; TRUNCATE TABLE `catalog_product_index_price_bundle_opt_idx`; TRUNCATE TABLE `catalog_product_index_price_bundle_opt_tmp`; TRUNCATE TABLE `catalog_product_index_price_bundle_sel_idx`; TRUNCATE TABLE `catalog_product_index_price_bundle_sel_tmp`; TRUNCATE TABLE `catalog_product_index_price_bundle_tmp`; TRUNCATE TABLE `catalog_product_index_price_cfg_opt_agr_idx`; TRUNCATE TABLE `catalog_product_index_price_cfg_opt_agr_tmp`; TRUNCATE TABLE `catalog_product_index_price_cfg_opt_idx`; TRUNCATE TABLE `catalog_product_index_price_cfg_opt_tmp`; TRUNCATE TABLE `catalog_product_index_price_downlod_idx`; TRUNCATE TABLE `catalog_product_index_price_downlod_tmp`; TRUNCATE TABLE `catalog_product_index_price_final_idx`; TRUNCATE TABLE `catalog_product_index_price_final_tmp`; TRUNCATE TABLE `catalog_product_index_price_idx`; TRUNCATE TABLE `catalog_product_index_price_opt_agr_idx`; TRUNCATE TABLE `catalog_product_index_price_opt_agr_tmp`; TRUNCATE TABLE `catalog_product_index_price_opt_idx`; TRUNCATE TABLE `catalog_product_index_price_opt_tmp`; TRUNCATE TABLE `catalog_product_index_price_tmp`; TRUNCATE TABLE `catalog_product_index_tier_price`; TRUNCATE TABLE `catalog_product_index_website`; TRUNCATE TABLE `catalog_product_link`; TRUNCATE TABLE `catalog_product_link_attribute`; TRUNCATE TABLE `catalog_product_link_attribute_decimal`; TRUNCATE TABLE `catalog_product_link_attribute_int`; TRUNCATE TABLE `catalog_product_link_attribute_varchar`; TRUNCATE TABLE `catalog_product_link_type`; TRUNCATE TABLE `catalog_product_option`; TRUNCATE TABLE `catalog_product_option_price`; TRUNCATE TABLE `catalog_product_option_title`; TRUNCATE TABLE `catalog_product_option_type_price`; TRUNCATE TABLE `catalog_product_option_type_title`; TRUNCATE TABLE `catalog_product_option_type_value`; TRUNCATE TABLE `catalog_product_relation`; TRUNCATE TABLE `catalog_product_super_attribute`; TRUNCATE TABLE `catalog_product_super_attribute_label`; TRUNCATE TABLE `catalog_product_super_link`; TRUNCATE TABLE `catalog_product_website`; TRUNCATE TABLE `catalog_url_rewrite_product_category`; TRUNCATE TABLE `cataloginventory_stock`; TRUNCATE TABLE `cataloginventory_stock_item`; TRUNCATE TABLE `cataloginventory_stock_status`; TRUNCATE TABLE `cataloginventory_stock_status_idx`; TRUNCATE TABLE `cataloginventory_stock_status_tmp`; TRUNCATE TABLE `downloadable_link`; TRUNCATE TABLE `downloadable_link_price`; TRUNCATE TABLE `downloadable_link_purchased`; TRUNCATE TABLE `downloadable_link_purchased_item`; TRUNCATE TABLE `downloadable_link_title`; TRUNCATE TABLE `downloadable_sample`; TRUNCATE TABLE `downloadable_sample_title`; TRUNCATE TABLE `product_alert_price`; TRUNCATE TABLE `product_alert_stock`; TRUNCATE TABLE `report_compared_product_index`; TRUNCATE TABLE `report_viewed_product_aggregated_daily`; TRUNCATE TABLE `report_viewed_product_aggregated_monthly`; TRUNCATE TABLE `report_viewed_product_aggregated_yearly`; TRUNCATE TABLE `report_viewed_product_index`; SET FOREIGN_KEY_CHECKS = 1;
Hello @chathuramk
Please run below commands to fix this and then try again:
php bin/magento indexer:reindex php bin/magento cache:flush
Hi @Manish Mittal,
I tried this. Still not working
Hi @chathuramk
I understand the error you are facing.
Do one thing go to your var/log directory from there you will find exception.log file - open it and check what error log is there - post the same error log over here
so its help us to trouble shoot the issue.
Also as an manual solution i would say upload/import your database again from your backup - so the error will be resolved.
Hope it helps
Hi @Manthan Dave,
I found below error message on var>log>debug.log file.
[2018-10-07 17:41:55] main.DEBUG: cache_invalidate: {"method":"POST","url":"https://inter.equipment/backoffice/catalog/product/save/type/simple/store/0/set/4/key/2459dcb60dee7cc66bcfdffca5bf089b430327d3b2c982ae780f5cde5dae56db/back/edit","invalidateInfo":{"tags":["catalog_product_379","catalog_category_product_2","catalog_category_product_23223"],"mode":"matchingAnyTag"},"is_exception":false} [] [2018-10-07 17:41:55] main.DEBUG: cache_invalidate: {"method":"POST","url":"https://inter.equipment/backoffice/catalog/product/save/type/simple/store/0/set/4/key/2459dcb60dee7cc66bcfdffca5bf089b430327d3b2c982ae780f5cde5dae56db/back/edit","invalidateInfo":{"servers":["[object] (Zend\\Uri\\Uri: http://inter.equipment:80/)"],"tagsPattern":"((^|,)catalog_product_379(,|$))|((^|,)catalog_category_product_2(,|$))|((^|,)catalog_category_product_23223(,|$))"},"is_exception":false} []
System.log file is not updating in this case.
Hello,
I think there might be some issue with cache. Can you once try after disabling the cache.
For better insight regarding message in logs that you mentioned have a look here: https://magento.stackexchange.com/questions/138786/magento-2-admin-attention-something-went-wrong
Problem solved? Click Kudos & Accept as Solution!
I have installed Magento 2.2.6 in Google cloud VM. It is a fresh install and when I try to save a simple product, I get the following error:
"Unable to save Stock Item"
My exception log shows the following error:
/var/www/html/app/code/Magento/CatalogInventory/Model/Stock/StockItemRepository.php:183,
Im stuck in this error and not sure about the solution: I to tried decompile, upgrade, cache clean, cache flush, static deploymenI'mbut Im unable to solve this issue.
I applied chmod 777 to the /var/www/html/app/code folder but unable to rectify the error.
I will be happy if someone can provide a solution for this error.
Check if elasticsearch is enable in catalog > catalog > catalog search
If it is active, but not installed, you will see this error.
Solution: change de search engine to the: Mysql
run: bin/magento c:f
run: bin/magento index:reindex
run: bin/magento c:f
Did you solved the issue
I'm experiencing the same issue in magento2.3 instance after clearing the test data. I've done re-indexing, clearing cache and all possible solutions. Could you please help