0

I've been trying to discover a solution to my current problem. This has affected Magento version 2.1.1, 2.1.2 and my update to 2.1.3. When saving certain categories I get a (very informative) error message.

enter image description here

In my exception.log I have the following

[2016-12-16 16:25:49] main.CRITICAL: Exception: Notice: unserialize(): Error at offset 31 of 33 bytes in /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/module-url-rewrite/Service/V1/Data/UrlRewrite.php on line 219 in /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/framework/App/ErrorHandler.php:61
Stack trace:
#0 [internal function]: Magento\Framework\App\ErrorHandler->handler(8, 'unserialize(): ...', '/var/www/vhosts...', 219, Array)
#1 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/module-url-rewrite/Service/V1/Data/UrlRewrite.php(219): unserialize('a:1:{s:11:"cate...')
#2 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/module-catalog-url-rewrite/Model/Product/CurrentUrlRewritesRegenerator.php(155): Magento\UrlRewrite\Service\V1\Data\UrlRewrite->getMetadata()
#3 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/module-catalog-url-rewrite/Model/Product/CurrentUrlRewritesRegenerator.php(77): Magento\CatalogUrlRewrite\Model\Product\CurrentUrlRewritesRegenerator->retrieveCategoryFromMetadata(Object(Magento\UrlRewrite\Service\V1\Data\UrlRewrite))
#4 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/module-catalog-url-rewrite/Model/ProductUrlRewriteGenerator.php(174): Magento\CatalogUrlRewrite\Model\Product\CurrentUrlRewritesRegenerator->generate('1', Object(Magento\Catalog\Model\Product\Interceptor), Object(Magento\CatalogUrlRewrite\Model\ObjectRegistry))
#5 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/module-catalog-url-rewrite/Model/ProductUrlRewriteGenerator.php(146): Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator->generateForSpecificStoreView('1', Object(Magento\Catalog\Model\ResourceModel\Category\Collection))
#6 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/module-catalog-url-rewrite/Model/ProductUrlRewriteGenerator.php(114): Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator->generateForGlobalScope(Object(Magento\Catalog\Model\ResourceModel\Category\Collection))
#7 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/module-catalog-url-rewrite/Observer/UrlRewriteHandler.php(119): Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator->generate(Object(Magento\Catalog\Model\Product\Interceptor))
#8 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/module-catalog-url-rewrite/Observer/UrlRewriteHandler.php(85): Magento\CatalogUrlRewrite\Observer\UrlRewriteHandler->getCategoryProductsUrlRewrites(Object(Magento\Catalog\Model\Category\Interceptor), 0, true)
#9 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/module-catalog-url-rewrite/Observer/CategoryProcessUrlRewriteSavingObserver.php(58): Magento\CatalogUrlRewrite\Observer\UrlRewriteHandler->generateProductUrlRewrites(Object(Magento\Catalog\Model\Category\Interceptor))
#10 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/framework/Event/Invoker/InvokerDefault.php(73): Magento\CatalogUrlRewrite\Observer\CategoryProcessUrlRewriteSavingObserver->execute(Object(Magento\Framework\Event\Observer))
#11 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/framework/Event/Invoker/InvokerDefault.php(61): Magento\Framework\Event\Invoker\InvokerDefault->_callObserverMethod(Object(Magento\CatalogUrlRewrite\Observer\CategoryProcessUrlRewriteSavingObserver), Object(Magento\Framework\Event\Observer))
#12 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/framework/Event/Manager.php(66): Magento\Framework\Event\Invoker\InvokerDefault->dispatch(Array, Object(Magento\Framework\Event\Observer))
#13 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/var/generation/Magento/Framework/Event/Manager/Proxy.php(95): Magento\Framework\Event\Manager->dispatch('catalog_categor...', Array)
#14 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/framework/Model/AbstractModel.php(802): Magento\Framework\Event\Manager\Proxy->dispatch('catalog_categor...', Array)
#15 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/module-catalog/Model/Category.php(1077): Magento\Framework\Model\AbstractModel->afterSave()
#16 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/var/generation/Magento/Catalog/Model/Category/Interceptor.php(583): Magento\Catalog\Model\Category->afterSave()
#17 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/framework/EntityManager/Observer/AfterEntitySave.php(34): Magento\Catalog\Model\Category\Interceptor->afterSave()
#18 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/framework/Event/Invoker/InvokerDefault.php(73): Magento\Framework\EntityManager\Observer\AfterEntitySave->execute(Object(Magento\Framework\Event\Observer))
#19 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/framework/Event/Invoker/InvokerDefault.php(61): Magento\Framework\Event\Invoker\InvokerDefault->_callObserverMethod(Object(Magento\Framework\EntityManager\Observer\AfterEntitySave), Object(Magento\Framework\Event\Observer))
#20 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/framework/Event/Manager.php(66): Magento\Framework\Event\Invoker\InvokerDefault->dispatch(Array, Object(Magento\Framework\Event\Observer))
#21 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/var/generation/Magento/Framework/Event/Manager/Proxy.php(95): Magento\Framework\Event\Manager->dispatch('magento_catalog...', Array)
#22 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/framework/EntityManager/EventManager.php(51): Magento\Framework\Event\Manager\Proxy->dispatch('magento_catalog...', Array)
#23 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/framework/EntityManager/Operation/Update.php(108): Magento\Framework\EntityManager\EventManager->dispatchEntityEvent('Magento\\Catalog...', 'save_after', Array)
#24 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/framework/EntityManager/EntityManager.php(87): Magento\Framework\EntityManager\Operation\Update->execute(Object(Magento\Catalog\Model\Category\Interceptor), Array)
#25 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/module-catalog/Model/ResourceModel/Category.php(1027): Magento\Framework\EntityManager\EntityManager->save(Object(Magento\Catalog\Model\Category\Interceptor))
#26 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Catalog\Model\ResourceModel\Category->save(Object(Magento\Catalog\Model\Category\Interceptor))
#27 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Catalog\Model\ResourceModel\Category\Interceptor->___callParent('save', Array)
#28 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Catalog...', 'save', Object(Magento\Catalog\Model\ResourceModel\Category\Interceptor), Array, 'catalogsearchFu...')
#29 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/module-catalog-search/Model/Indexer/Fulltext/Plugin/Category.php(43): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Catalog\Model\Category\Interceptor))
#30 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/module-catalog-search/Model/Indexer/Fulltext/Plugin/Category.php(29): Magento\CatalogSearch\Model\Indexer\Fulltext\Plugin\Category->addCommitCallback(Object(Magento\Catalog\Model\ResourceModel\Category\Interceptor), Object(Closure), Object(Magento\Catalog\Model\Category\Interceptor))
#31 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\CatalogSearch\Model\Indexer\Fulltext\Plugin\Category->aroundSave(Object(Magento\Catalog\Model\ResourceModel\Category\Interceptor), Object(Closure), Object(Magento\Catalog\Model\Category\Interceptor))
#32 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Catalog...', 'save', Object(Magento\Catalog\Model\ResourceModel\Category\Interceptor), Array, 'clean_cache')
#33 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/framework/App/Cache/FlushCacheByTags.php(71): Magento\Catalog\Model\ResourceModel\Category\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Catalog\Model\Category\Interceptor))
#34 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/framework/Interception/Interceptor.php(142): Magento\Framework\App\Cache\FlushCacheByTags->aroundSave(Object(Magento\Catalog\Model\ResourceModel\Category\Interceptor), Object(Closure), Object(Magento\Catalog\Model\Category\Interceptor))
#35 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/var/generation/Magento/Catalog/Model/ResourceModel/Category/Interceptor.php(364): Magento\Catalog\Model\ResourceModel\Category\Interceptor->___callPlugins('save', Array, Array)
#36 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/framework/Model/AbstractModel.php(631): Magento\Catalog\Model\ResourceModel\Category\Interceptor->save(Object(Magento\Catalog\Model\Category\Interceptor))
#37 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/framework/Interception/Interceptor.php(146): Magento\Framework\Model\AbstractModel->save()
#38 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/var/generation/Magento/Catalog/Model/Category/Interceptor.php(1534): Magento\Catalog\Model\Category\Interceptor->___callPlugins('save', Array, Array)
#39 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/module-catalog/Controller/Adminhtml/Category/Save.php(203): Magento\Catalog\Model\Category\Interceptor->save()
#40 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/var/generation/Magento/Catalog/Controller/Adminhtml/Category/Save/Interceptor.php(24): Magento\Catalog\Controller\Adminhtml\Category\Save->execute()
#41 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/framework/App/Action/Action.php(102): Magento\Catalog\Controller\Adminhtml\Category\Save\Interceptor->execute()
#42 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/module-backend/App/AbstractAction.php(226): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http))
#43 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Backend\App\AbstractAction->dispatch(Object(Magento\Framework\App\Request\Http))
#44 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Catalog\Controller\Adminhtml\Category\Save\Interceptor->___callParent('dispatch', Array)
#45 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Catalog...', 'dispatch', Object(Magento\Catalog\Controller\Adminhtml\Category\Save\Interceptor), Array, 'adminAuthentica...')
#46 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/module-backend/App/Action/Plugin/Authentication.php(143): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Request\Http))
#47 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch(Object(Magento\Catalog\Controller\Adminhtml\Category\Save\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#48 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Catalog...', 'dispatch', Object(Magento\Catalog\Controller\Adminhtml\Category\Save\Interceptor), Array, 'adminMassaction...')
#49 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/module-backend/App/Action/Plugin/MassactionKey.php(33): Magento\Catalog\Controller\Adminhtml\Category\Save\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#50 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/framework/Interception/Interceptor.php(142): Magento\Backend\App\Action\Plugin\MassactionKey->aroundDispatch(Object(Magento\Catalog\Controller\Adminhtml\Category\Save\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#51 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/var/generation/Magento/Catalog/Controller/Adminhtml/Category/Save/Interceptor.php(65): Magento\Catalog\Controller\Adminhtml\Category\Save\Interceptor->___callPlugins('dispatch', Array, Array)
#52 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/framework/App/FrontController.php(55): Magento\Catalog\Controller\Adminhtml\Category\Save\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#53 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))
#54 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)
#55 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Array, 'install')
#56 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/framework/Module/Plugin/DbStatusValidator.php(69): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#57 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/framework/Interception/Interceptor.php(142): Magento\Framework\Module\Plugin\DbStatusValidator->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#58 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/var/generation/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, Array)
#59 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#60 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/framework/Interception/Interceptor.php(146): Magento\Framework\App\Http->launch()
#61 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/var/generation/Magento/Framework/App/Http/Interceptor.php(26): Magento\Framework\App\Http\Interceptor->___callPlugins('launch', Array, Array)
#62 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http\Interceptor->launch()
#63 /var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/pub/index.php(37): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))
#64 {main} [] []

Has anybody come across this error and solution to it? I'm not sure where to look next to try and fix the issue.

0

Nope there will be no issue in Magento 2.1.X Versions.

As Error Says it's issue with your Category URL

/var/www/vhosts/domain.com/deployments/releases/20161216152711/magento/vendor/magento/module-url-rewrite/Service/V1/Data/UrlRewrite.php

Solution

Delete You Category & Add it Again. Please check your URL should be Unique

0

Doesn't seem like a Magento issue. Find out what the string (a:1:{s:11:"cate...) is and can you post it here? I'm curious to see what it is.

I've experienced some finicky serialize/unserialize before.

0

After more testing it turns out the issue was with a certain product assigned to the category. The fix was to delete the product from the system and re-add manually.

The products were originally imported into the system using Magento 2's default product import system by another developer so I'm not sure how the product became an issue.

Thanks for the above suggestions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.