Magento – Magento2 error ltrim() expects parameter 1 to be string, array given

magento2migration

I moved my Magento 2.2.5 based website into another existing site in-order to make them both a multi-site website. I used a paid migration tool and all seemed to go fine, now when I am editing some products to add them to a category for one of my store views I am getting the below error. I even tried deleting the category from the admin panel and then tried for re-creating the category thinking, maybe something with the category just didn't migrate over correctly.

No such entity with id = 128

 Warning: ltrim() expects parameter 1 to be string, array given in vendor/magento/module-catalog/Model/Category/FileInfo.php on line 102

I am not sure how to find out what entity id 128 is . I checked all my other categories which have category images and descriptions added to them all that looks fine.

Any suggestions on how to troubleshoot this further and or how to fix it? I also checked my folder and file permissions already

Best Answer

This issue is showing after the data migration because some product or category have duplicate rewrite Url in url_rewrite table

a) You can search the duplicate url and rename/ remove

b) vendor/magento/module-url-rewrite/Model/Storage/DbStorage.php

Edit this file or overwrite this file

            protected function insertMultiple($data)
                {
                    try {
                        return true;

Note : after changes run the reindex command

php bin/magento indexer:reindex
Related Topic