Skip to content

ERROR Illegal offset type on reindexing catalog_product_attribute. Cant reindex product attributes

Upgraded from Magento2.4.2pt1 to Magento2.4.4-pt1. Now reindexing from SSH I am getting error with reindexing catalog_product_attribute.

php -d memory_limit=2G bin/magento indexer:reindex catalog_product_attribute

ERROR

Product EAV index process error during indexation process:
Warning: Illegal offset type in /vendor/magento/module-catalog/Model/ResourceModel/Product/Indexer/Eav/Source.php on line 392.

Will not let me reindex catalog_product_attribute.

Magento2.4.4pt code /magento/module-catalog/Model/ResourceModel/Product/Indexer/Eav/Source.php failling on line 392. Code function below.

    private function getMultiSelectAttributeWithSourceModels($attrIds)
    {
        // Add options from custom source models
        $this->criteriaBuilder
                ->addFilter('attribute_id', $attrIds, 'in')
                ->addFilter('source_model', true, 'notnull');
        $criteria = $this->criteriaBuilder->create();
        $attributes = $this->attributeRepository->getList(
            ProductAttributeInterface::ENTITY_TYPE_CODE,
            $criteria
        )->getItems();

        $options = [];
        foreach ($attributes as $attribute) {
            $sourceModelOptions = $attribute->getOptions();
            // Add options to list used below
            foreach ($sourceModelOptions as $option) {
                $options[$attribute->getAttributeId()][$option->getValue()] = true; 
    LINE 392 where its failing.
            } 
        }

        return $options;
    }

I am not sure why I am getting this error or how to fix. What would be the best way to debug this? Any help would be greatly appreciated. Thank you!