0

I've seen this error before and I believe i've fixed it in the past but i can't seem to resolve it atm. So the Argument 1 passed must be of the type array, null given, called in vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 121.

I think it something to do with an eav attribute related to customers. Not sure how to determine which attribute it may be because we have alot.

I did see a possible quick fix/patch that said to do this but i know it goes against magento values by editing the core.

\Eav\Model\Entity\Attribute\Source\ConfigFactory

in code you have line like this

$this->configFactory->create();

but should be

$this->configFactory->create($optionsData); 

1 exception(s):
Exception #0 (Magento\Framework\Exception\RuntimeException): Type Error occurred when creating object: Magento\Eav\Model\Entity\Attribute\Source\Config, Argument 1 passed to Magento\Eav\Model\Entity\Attribute\Source\Config::__construct() must be of the type array, null given, called in /srv/public_html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 121

Exception #0 (Magento\Framework\Exception\RuntimeException): Type Error occurred when creating object: Magento\Eav\Model\Entity\Attribute\Source\Config, Argument 1 passed to Magento\Eav\Model\Entity\Attribute\Source\Config::__construct() must be of the type array, null given, called in /srv/public_html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 121
<pre>#1 Magento\Framework\ObjectManager\Factory\Compiled->create() called at [vendor/magento/framework/ObjectManager/ObjectManager.php:56]
#2 Magento\Framework\ObjectManager\ObjectManager->create() called at [vendor/magento/framework/Validator/UniversalFactory.php:36]
#3 Magento\Framework\Validator\UniversalFactory->create() called at [vendor/magento/module-eav/Model/Entity/Attribute/AbstractAttribute.php:642]
#4 Magento\Eav\Model\Entity\Attribute\AbstractAttribute->getSource() called at [vendor/magento/module-customer/Model/AttributeMetadataConverter.php:98]
#5 Magento\Customer\Model\AttributeMetadataConverter->createMetadataAttribute() called at [vendor/magento/module-customer/Model/Metadata/AddressMetadata.php:77]
#6 Magento\Customer\Model\Metadata\AddressMetadata->getAttributeMetadata() called at [vendor/magento/module-customer/Model/Metadata/AddressMetadata.php:109]
#7 Magento\Customer\Model\Metadata\AddressMetadata->getAllAttributesMetadata() called at [vendor/magento/module-customer/Model/Metadata/CachedMetadata.php:85]
#8 Magento\Customer\Model\Metadata\CachedMetadata->getAllAttributesMetadata() called at [vendor/magento/module-customer/Ui/Component/Listing/AttributeRepository.php:90]
#9 Magento\Customer\Ui\Component\Listing\AttributeRepository->getList() called at [vendor/magento/module-customer/Ui/Component/Listing/Columns.php:112]
#10 Magento\Customer\Ui\Component\Listing\Columns->prepare() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#11 Magento\Customer\Ui\Component\Listing\Columns\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#12 Magento\Customer\Ui\Component\Listing\Columns\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/amasty/orderattr/Model/ResourceModel/Value/Plugin/Order/Grid/Columns.php:57]
#13 Amasty\Orderattr\Model\ResourceModel\Value\Plugin\Order\Grid\Columns->aroundPrepare() called at [vendor/magento/framework/Interception/Interceptor.php:135]
#14 Magento\Customer\Ui\Component\Listing\Columns\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#15 Magento\Customer\Ui\Component\Listing\Columns\Interceptor->___callPlugins() called at [generated/code/Magento/Customer/Ui/Component/Listing/Columns/Interceptor.php:23]
#16 Magento\Customer\Ui\Component\Listing\Columns\Interceptor->prepare() called at [vendor/magento/framework/View/Layout/Generator/UiComponent.php:164]
#17 Magento\Framework\View\Layout\Generator\UiComponent->prepareComponent() called at [vendor/magento/framework/View/Layout/Generator/UiComponent.php:161]
#18 Magento\Framework\View\Layout\Generator\UiComponent->prepareComponent() called at [vendor/magento/framework/View/Layout/Generator/UiComponent.php:142]
#19 Magento\Framework\View\Layout\Generator\UiComponent->generateComponent() called at [vendor/magento/framework/View/Layout/Generator/UiComponent.php:103]
#20 Magento\Framework\View\Layout\Generator\UiComponent->process() called at [vendor/magento/framework/View/Layout/GeneratorPool.php:93]
#21 Magento\Framework\View\Layout\GeneratorPool->process() called at [vendor/magento/framework/View/Layout.php:365]
#22 Magento\Framework\View\Layout->generateElements() called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:32]
#23 Magento\Framework\View\Layout\Interceptor->generateElements() called at [vendor/magento/framework/View/Layout/Builder.php:129]
#24 Magento\Framework\View\Layout\Builder->generateLayoutBlocks() called at [vendor/magento/framework/View/Page/Builder.php:65]
#25 Magento\Framework\View\Page\Builder->generateLayoutBlocks() called at [vendor/magento/framework/View/Layout/Builder.php:65]
#26 Magento\Framework\View\Layout\Builder->build() called at [vendor/magento/framework/View/Layout.php:271]
#27 Magento\Framework\View\Layout->build() called at [vendor/magento/framework/View/Layout.php:896]
#28 Magento\Framework\View\Layout->getBlock() called at [vendor/magento/module-backend/Model/View/Result/Page.php:26]
#29 Magento\Backend\Model\View\Result\Page->setActiveMenu() called at [vendor/magento/module-customer/Controller/Adminhtml/Index/Index.php:28]
#30 Magento\Customer\Controller\Adminhtml\Index\Index->execute() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#31 Magento\Customer\Controller\Adminhtml\Index\Index\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#32 Magento\Customer\Controller\Adminhtml\Index\Index\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#33 Magento\Customer\Controller\Adminhtml\Index\Index\Interceptor->___callPlugins() called at [generated/code/Magento/Customer/Controller/Adminhtml/Index/Index/Interceptor.php:23]
#34 Magento\Customer\Controller\Adminhtml\Index\Index\Interceptor->execute() called at [vendor/magento/framework/App/Action/Action.php:111]
#35 Magento\Framework\App\Action\Action->dispatch() called at [vendor/magento/module-backend/App/AbstractAction.php:151]
#36 Magento\Backend\App\AbstractAction->dispatch() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#37 Magento\Customer\Controller\Adminhtml\Index\Index\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#38 Magento\Customer\Controller\Adminhtml\Index\Index\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/module-backend/App/Action/Plugin/Authentication.php:145]
#39 Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch() called at [vendor/magento/framework/Interception/Interceptor.php:135]
#40 Magento\Customer\Controller\Adminhtml\Index\Index\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#41 Magento\Customer\Controller\Adminhtml\Index\Index\Interceptor->___callPlugins() called at [generated/code/Magento/Customer/Controller/Adminhtml/Index/Index/Interceptor.php:32]
#42 Magento\Customer\Controller\Adminhtml\Index\Index\Interceptor->dispatch() called at [vendor/magento/framework/App/FrontController.php:245]
#43 Magento\Framework\App\FrontController->getActionResponse() called at [vendor/magento/framework/App/FrontController.php:212]
#44 Magento\Framework\App\FrontController->processRequest() called at [vendor/magento/framework/App/FrontController.php:147]
#45 Magento\Framework\App\FrontController->dispatch() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#46 Magento\Framework\App\FrontController\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#47 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#48 Magento\Framework\App\FrontController\Interceptor->___callPlugins() called at [generated/code/Magento/Framework/App/FrontController/Interceptor.php:23]
#49 Magento\Framework\App\FrontController\Interceptor->dispatch() called at [vendor/magento/framework/App/Http.php:116]
#50 Magento\Framework\App\Http->launch() called at [vendor/magento/framework/App/Bootstrap.php:264]
#51 Magento\Framework\App\Bootstrap->run() called at [pub/index.php:30]
</pre>

Has anybody else ran into this issue and know of a fix?

1 Answer 1

0

I think you have in some module a datapatch that tries to add this eav attribute, probably the definition of the attribute doesn´t have the array standard to create the necessary key => values to pass in the constructor method, example:

/**
 * @inheritdoc
 */
public function apply()
{
    $customerSetup = $this->customerSetupFactory->create(['setup' => $this->moduleDataSetup]);
    $customerSetup->addAttribute(Customer::ENTITY, 'attribute_code', [
        "label" => "my custom attr",
        "type"  => "varchar",
         ...
    ]);
}

In other wise you can set a breakpoint in the line that throws your error vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 121, and see the arguments that the function createObject($type, $args) this can tell you more detail about the especific attribute that is going wrong

1
  • Thank you i'll test out a breakpoint.
    – Head
    Jul 28, 2022 at 15:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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