
Magento 2.x: Setup upgrade error “We can’t find the role for the user you wanted” – quick fix
If you are getting the error “We can’t find the role for the user you wanted”, while you are trying to do a php bin/magento setup:upgrade, the following workaround would help you.
go to file: vendor/magento/module-authorization/Model/Acl/AclRetriever.php at line# 85 and change original code into edit one:
Original code:
1 2 3 4 5 6 |
if (!$role) { throw new AuthorizationException( __('We can\'t find the role for the user you wanted.') ); } $allowedResources = $this->getAllowedResourcesByRole($role->getId()); |
Edit code:
1 2 3 4 5 |
if (!$role) { $allowedResources = array(); }else{ $allowedResources = $this->getAllowedResourcesByRole($role->getId()); } |
Then, run php bin/magento setup:upgrade.
IMPORTANT: Once success, please revert back the file.