7

enter image description here

When i'm trying to view my all migrated customers then getting following error.

1 exception(s):
 Exception #0 (BadMethodCallException): Missing required argument $options    of Magento\Eav\Model\Entity\Attribute\Source\Config.

Exception #0 (BadMethodCallException): Missing required argument $options of Magento\Eav\Model\Entity\Attribute\Source\Config.
#0 /var/www/html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(82): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments('Magento\\Eav\\Mod...', Array, Array)
#1 /var/www/html/vendor/magento/framework/ObjectManager/ObjectManager.php(57): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Eav\\Mod...', Array)
#2 /var/www/html/vendor/magento/framework/Validator/UniversalFactory.php(36): Magento\Framework\ObjectManager\ObjectManager->create('Magento\\Eav\\Mod...', Array)
#3 /var/www/html/vendor/magento/module-eav/Model/Entity/Attribute/AbstractAttribute.php(537): Magento\Framework\Validator\UniversalFactory->create('Magento\\Eav\\Mod...')
#4 /var/www/html/vendor/magento/module-customer/Model/AttributeMetadataConverter.php(66): Magento\Eav\Model\Entity\Attribute\AbstractAttribute->getSource()
#5 /var/www/html/vendor/magento/module-customer/Model/Metadata/CustomerMetadata.php(77): Magento\Customer\Model\AttributeMetadataConverter->createMetadataAttribute(Object(Magento\Customer\Model\Attribute))
#6 /var/www/html/vendor/magento/module-customer/Model/Metadata/CustomerMetadata.php(109): Magento\Customer\Model\Metadata\CustomerMetadata->getAttributeMetadata('assigned_sales_...')
#7 /var/www/html/vendor/magento/module-customer/Model/Metadata/CachedMetadata.php(82): Magento\Customer\Model\Metadata\CustomerMetadata->getAllAttributesMetadata()
#8 /var/www/html/vendor/magento/module-customer/Ui/Component/Listing/AttributeRepository.php(66): Magento\Customer\Model\Metadata\CachedMetadata->getAllAttributesMetadata()
#9 /var/www/html/vendor/magento/module-customer/Ui/Component/Listing/Columns.php(96): Magento\Customer\Ui\Component\Listing\AttributeRepository->getList()
#10 /var/www/html/vendor/magento/framework/View/Layout/Generator/UiComponent.php(148): Magento\Customer\Ui\Component\Listing\Columns->prepare()
#11 /var/www/html/vendor/magento/framework/View/Layout/Generator/UiComponent.php(145): Magento\Framework\View\Layout\Generator\UiComponent->prepareComponent(Object(Magento\Customer\Ui\Component\Listing\Columns))
#12 /var/www/html/vendor/magento/framework/View/Layout/Generator/UiComponent.php(126): Magento\Framework\View\Layout\Generator\UiComponent->prepareComponent(Object(Magento\Ui\Component\Listing))
#13 /var/www/html/vendor/magento/framework/View/Layout/Generator/UiComponent.php(93): Magento\Framework\View\Layout\Generator\UiComponent->generateComponent(Object(Magento\Framework\View\Layout\Data\Structure), 'customer_listin...', Array, Object(Magento\Framework\View\Layout\Interceptor))
#14 /var/www/html/vendor/magento/framework/View/Layout/GeneratorPool.php(86): Magento\Framework\View\Layout\Generator\UiComponent->process(Object(Magento\Framework\View\Layout\Reader\Context), Object(Magento\Framework\View\Layout\Generator\Context))
#15 /var/www/html/vendor/magento/framework/View/Layout.php(327): Magento\Framework\View\Layout\GeneratorPool->process(Object(Magento\Framework\View\Layout\Reader\Context), Object(Magento\Framework\View\Layout\Generator\Context))
#16 /var/www/html/var/generation/Magento/Framework/View/Layout/Interceptor.php(89): Magento\Framework\View\Layout->generateElements()
#17 /var/www/html/vendor/magento/framework/View/Layout/Builder.php(129): Magento\Framework\View\Layout\Interceptor->generateElements()
#18 /var/www/html/vendor/magento/framework/View/Page/Builder.php(55): Magento\Framework\View\Layout\Builder->generateLayoutBlocks()
#19 /var/www/html/vendor/magento/framework/View/Layout/Builder.php(65): Magento\Framework\View\Page\Builder->generateLayoutBlocks()
#20 /var/www/html/vendor/magento/framework/View/Layout.php(244): Magento\Framework\View\Layout\Builder->build()
#21 /var/www/html/vendor/magento/framework/View/Layout.php(859): Magento\Framework\View\Layout->build()
#22 /var/www/html/var/generation/Magento/Framework/View/Layout/Interceptor.php(414): Magento\Framework\View\Layout->getBlock('menu')
#23 /var/www/html/vendor/magento/module-backend/Model/View/Result/Page.php(59): Magento\Framework\View\Layout\Interceptor->getBlock('menu')
#24 /var/www/html/var/generation/Magento/Backend/Model/View/Result/Page/Interceptor.php(24): Magento\Backend\Model\View\Result\Page->setActiveMenu('Magento_Custome...')
#25 /var/www/html/vendor/magento/module-customer/Controller/Adminhtml/Index/Index.php(26): Magento\Backend\Model\View\Result\Page\Interceptor->setActiveMenu('Magento_Custome...')
#26 /var/www/html/var/generation/Magento/Customer/Controller/Adminhtml/Index/Index/Interceptor.php(24): Magento\Customer\Controller\Adminhtml\Index\Index->execute()
#27 /var/www/html/vendor/magento/framework/App/Action/Action.php(102): Magento\Customer\Controller\Adminhtml\Index\Index\Interceptor->execute()
#28 /var/www/html/vendor/magento/module-backend/App/AbstractAction.php(226): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http))
#29 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Backend\App\AbstractAction->dispatch(Object(Magento\Framework\App\Request\Http))
#30 /var/www/html/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Customer\Controller\Adminhtml\Index\Index\Interceptor->___callParent('dispatch', Array)
#31 /var/www/html/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Custome...', 'dispatch', Object(Magento\Customer\Controller\Adminhtml\Index\Index\Interceptor), Array, 'adminAuthentica...')
#32 /var/www/html/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))
#33 /var/www/html/vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch(Object(Magento\Customer\Controller\Adminhtml\Index\Index\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#34 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Custome...', 'dispatch', Object(Magento\Customer\Controller\Adminhtml\Index\Index\Interceptor), Array, 'adminMassaction...')
#35 /var/www/html/vendor/magento/module-backend/App/Action/Plugin/MassactionKey.php(33): Magento\Customer\Controller\Adminhtml\Index\Index\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#36 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(142): Magento\Backend\App\Action\Plugin\MassactionKey->aroundDispatch(Object(Magento\Customer\Controller\Adminhtml\Index\Index\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#37 /var/www/html/var/generation/Magento/Customer/Controller/Adminhtml/Index/Index/Interceptor.php(39): Magento\Customer\Controller\Adminhtml\Index\Index\Interceptor->___callPlugins('dispatch', Array, Array)
#38 /var/www/html/vendor/magento/framework/App/FrontController.php(55): Magento\Customer\Controller\Adminhtml\Index\Index\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#39 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))
#40 /var/www/html/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)
#41 /var/www/html/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Array, 'install')
#42 /var/www/html/vendor/magento/framework/Module/Plugin/DbStatusValidator.php(69): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Request\Http))
#43 /var/www/html/vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\Framework\Module\Plugin\DbStatusValidator->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#44 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Array, 'infortis_cgen_m...')
#45 /var/www/html/app/code/Infortis/Cgen/Plugin/Magento/Framework/App/FrontController.php(32): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#46 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(142): Infortis\Cgen\Plugin\Magento\Framework\App\FrontController->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#47 /var/www/html/var/generation/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, Array)
#48 /var/www/html/vendor/magento/framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#49 /var/www/html/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http->launch()
#50 /var/www/html/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#51 {main}

Update After compile and removed generation folder:

Fatal error: Uncaught TypeError: Argument 1 passed to Magento\Eav\Model\Entity\Attribute\Source\Config::__construct() must be of the type array, null given, called in /var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 93 and defined in /var/www/html/vendor/magento/module-eav/Model/Entity/Attribute/Source/Config.php:26 
Stack trace: #0 /var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(93): Magento\Eav\Model\Entity\Attribute\Source\Config->__construct(NULL) 
#1 /var/www/html/vendor/magento/framework/ObjectManager/Factory/Compiled.php(88): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Magento\\Eav\\Mod...', Array) 
#2 /var/www/html/vendor/magento/framework/ObjectManager/ObjectManager.php(57): Magento\Framework\ObjectManager\Factory\Compiled->create('Magento\\Eav\\Mod...', Array) 
#3 /var/www/html/vendor/magento/framework/Validator/UniversalFactory.php(36): Magento\Framework\ObjectManager\ObjectManager->create('Magento\\Eav\\Mod...', Arr in /var/www/html/vendor/magento/module-eav/Model/Entity/Attribute/Source/Config.php on line 26
8
  • Clear var/generation folder & run php bin/magento setup:di:compile
    – Jackson
    Commented Mar 8, 2017 at 1:39
  • @Ankit I have done things as told by u. Error is not showing but when I'm trying to see customers it shows blank page. What should I do next? Commented Mar 8, 2017 at 8:05
  • Run command in order php bin/magento setup:upgrade php bin/magento setup:di:compile php bin/magento setup:static-content:deploy php bin/magento indexer:reindex php bin/magento cache:flush & check for var\log for error logs exception.log
    – Jackson
    Commented Mar 8, 2017 at 8:10
  • @Ankit After enable of error reporting it shows error. I have updated question with that error. Commented Mar 8, 2017 at 8:23
  • Go to magento\vendor & delete all files & folders then run composer install on root
    – Jackson
    Commented Mar 8, 2017 at 8:27

7 Answers 7

11

Go to file var/www/html/vendor/magento/module-customer/Model/Config.php

Change to line 26 it will give detail description about error public function __construct(array $options) to public function __construct($options)

Detail error description

    Exception #0 (Magento\Framework\Exception\LocalizedException): No options found.
    #0 /var/www/html/vendor/magento/module-customer/Model/AttributeMetadataConverter.php(66): Magento\Eav\Model\Entity\Attribute\Source\Config->getAllOptions()
    #1 /var/www/html/vendor/magento/module-customer/Model/Metadata/CustomerMetadata.php(77): Magento\Customer\Model\AttributeMetadataConverter->createMetadataAttribute(Object(Magento\Customer\Model\Attribute))
    #2 /var/www/html/vendor/magento/module-customer/Model/Metadata/CustomerMetadata.php(109): Magento\Customer\Model\Metadata\CustomerMetadata->getAttributeMetadata('assigned_sales_...')
    .
    .
    etc

Then from that description take

#0 /var/www/html/vendor/magento/module-customer/Model/AttributeMetadataConverter.php(66):

Go to above file enter following code before line 66

echo '<pre>';
print_r($attribute->getData());

Then I get list of attribute_ids and see after which attribute_id error is comming take that one.

So I get attribute_id 150 who doesn't getting options.

So I'm not using that attribute_id so i have remove it..

Now my problem is solved and I can see my all migrated customers.

Please revert back all changes made in core files.

7
  • I tried the way which you said I too get that Id. In which table you have removed that attribute_id? which in your case is 150 Commented Jul 31, 2017 at 17:56
  • 1
    I got the table its cuatomer_eav_attribute Commented Jul 31, 2017 at 18:45
  • 1
    Helli @Nitesh, file is not exist in this path var/www/html/vendor/magento/module-customer/Model/Config.php ,Using Magento 2.2.4 version.Please share some code so that I can check it.I have same problem.
    – akgola
    Commented Jul 18, 2018 at 8:13
  • 1
    @Pawankumar,Yes I found solution by deleting some attribute which was crated by third party module in Magento1.
    – akgola
    Commented Jan 22, 2019 at 11:38
  • 1
    In Magento 2.4.6 (migrated from 1.9.4.5) I had similar situation where Customers would crash; enabled developer mode which I saw AttributeMetadataConverter.php(100) and put simple var_export which was written to a file and VOILA! It was mailchimp attribute. Thank you for clue!
    – nordashi
    Commented Jul 21, 2023 at 0:54
6

I used this solution to solve the problem

  • open phpmyadmin
  • open 'customer_eav_attribute' table
  • find out what attributes are imported looking at rows id

enter image description here

as you can see from id 40 there is a large gap before next id

  • export a table backup ( so you can rollback if needed )
  • delete attributes that are imported but not well applied

in my specific case deleting rows with id 146,285,286,+ has solved the problem

1
2

In my case the problem was a custom select attribute that was missing source_model.

Steps to debug and fix:

  1. xdebug - place a breakpoint vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php#L261 (throw new \BadMethodCallException)
  2. go down through callstack and find the attribute_code
  3. On db run the query to get attribute data "select * from eav_attribute where attribute_id = [YOUR_ATTRIBUTE_ID] \G"
  4. Update source model of attribute (IF EMPTY) "update eav_attribute set source_model = 'Magento\Eav\Model\Entity\Attribute\Source\Table' where attribute_id = [YOUR_ATTRIBUTE_ID];"
1

I solved in this way:

  1. clean generated/code/ folder
  2. php bin/magento setup:di:compile

So, I have a new error type:

Uncaught TypeError: Argument 1 passed to Magento\Eav\Model\Entity\Attribute\Source\Config::__construct() must be of the type array, null given ..

  1. go to eav_attribute table, filtering for entity_type_id = 1 (Customer entity) and look for the custom source model in source_model column
  2. create the source model for Magento 2 (//Model/Attribute/
0

for me I deleted only rows with the following conditions

  • High ids that didn't run in sequence
  • that is not system attribute
  • that had 0 or null fields
0

I know I am late in this party but if you get this issue then please try replacing public function __construct(array $options) with this public function __construct(array $options = [])

Happy Coding

0

In my case, the issue is an EAV attribute created from a migration was missing it's source_model. I was able to figure out which attributes were the problem by var_dumping the attribute code here:

# file vendor/magento/module-eav/Model/Entity/Attribute/AbstractAttribute.php
# line 631

public function getSource()
{
    if (empty($this->_source)) {
        if (!$this->getSourceModel()) {
            $this->_source = $this->_getDefaultSourceModel();
        } else {
            $this->_source = $this->getSourceModel();
        }
        var_dump($this->getAttributeCode());                        // <----- here
        $source = $this->_universalFactory->create($this->_source);
        if (!$source) {
            throw new LocalizedException(
                __(
                    'Source model "%1" not found for attribute "%2"',
                    $this->getSourceModel(),
                    $this->getAttributeCode()
                )
            );
        }
        $this->_source = $source->setAttribute($this);
    }

    return $this->_source;
}

This will spit out many codes, but the last one in the list will be the offender. Another way to find the problematic attributes would be with this query:

select *
from eav_attribute
where frontend_input = 'select'
and source_model is null;

Because they're select inputs, they expect a source_model to provide those key/values. The simple solution is to change them to a text input:

update eav_attribute
set frontend_input = 'text'
where frontend_input = 'select'
and source_model is null;

Or you could create the missing model in a module and add its class as the source_type.

Your Answer

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

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