Problem/Motivation
I recently needed to uninstall purchasable_entity. Was not needing it. I uninstalled through the uninstall page and then removed it via composer.
I then ran across this error, trying to update some other permission today. From the permissions matrix page.
RuntimeException: Adding non-existent permissions to a role is not allowed. The incorrect permissions are "entity print access bundle purchasable_entity". in Drupal\user\Entity\Role->calculateDependencies() (line 210 of D:\wwwroot\pss-2024-fix\web\core\modules\user\src\Entity\Role.php).
#0 D:\wwwroot\pss-2024-fix\web\core\lib\Drupal\Core\Config\Entity\ConfigEntityBase.php(325): Drupal\user\Entity\Role->calculateDependencies()
#1 D:\wwwroot\pss-2024-fix\web\core\modules\user\src\Entity\Role.php(182): Drupal\Core\Config\Entity\ConfigEntityBase->preSave(Object(Drupal\user\RoleStorage))
#2 D:\wwwroot\pss-2024-fix\web\core\lib\Drupal\Core\Entity\EntityStorageBase.php(528): Drupal\user\Entity\Role->preSave(Object(Drupal\user\RoleStorage))
#3 D:\wwwroot\pss-2024-fix\web\core\lib\Drupal\Core\Entity\EntityStorageBase.php(483): Drupal\Core\Entity\EntityStorageBase->doPreSave(Object(Drupal\user\Entity\Role))
#4 D:\wwwroot\pss-2024-fix\web\core\lib\Drupal\Core\Config\Entity\ConfigEntityStorage.php(257): Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\user\Entity\Role))
#5 D:\wwwroot\pss-2024-fix\web\core\lib\Drupal\Core\Entity\EntityBase.php(354): Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object(Drupal\user\Entity\Role))
#6 D:\wwwroot\pss-2024-fix\web\core\lib\Drupal\Core\Config\Entity\ConfigEntityBase.php(614): Drupal\Core\Entity\EntityBase->save()
#7 D:\wwwroot\pss-2024-fix\web\core\modules\user\user.module(1010): Drupal\Core\Config\Entity\ConfigEntityBase->save()
#8 D:\wwwroot\pss-2024-fix\web\core\modules\user\user.module(984): user_role_grant_permissions('business_admins', Array)
#9 D:\wwwroot\pss-2024-fix\web\core\modules\user\src\Form\UserPermissionsForm.php(257): user_role_change_permissions('business_admins', Array)
#10 [internal function]: Drupal\user\Form\UserPermissionsForm->submitForm(Array, Object(Drupal\Core\Form\FormState))
#11 D:\wwwroot\pss-2024-fix\web\core\lib\Drupal\Core\Form\FormSubmitter.php(129): call_user_func_array(Array, Array)
#12 D:\wwwroot\pss-2024-fix\web\core\lib\Drupal\Core\Form\FormSubmitter.php(67): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object(Drupal\Core\Form\FormState))
#13 D:\wwwroot\pss-2024-fix\web\core\lib\Drupal\Core\Form\FormBuilder.php(597): Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object(Drupal\Core\Form\FormState))
#14 D:\wwwroot\pss-2024-fix\web\core\lib\Drupal\Core\Form\FormBuilder.php(326): Drupal\Core\Form\FormBuilder->processForm('user_admin_perm...', Array, Object(Drupal\Core\Form\FormState))
#15 D:\wwwroot\pss-2024-fix\web\core\lib\Drupal\Core\Form\FormBuilder.php(224): Drupal\Core\Form\FormBuilder->buildForm('\\Drupal\\user\\Fo...', Object(Drupal\Core\Form\FormState))
#16 D:\wwwroot\pss-2024-fix\web\modules\contrib\fpa\src\FpaFormBuilder.php(66): Drupal\Core\Form\FormBuilder->getForm('\\Drupal\\user\\Fo...')
#17 D:\wwwroot\pss-2024-fix\web\modules\contrib\fpa\src\Controller\FPAController.php(24): Drupal\fpa\FpaFormBuilder::buildFpaPage()
#18 [internal function]: Drupal\fpa\Controller\FPAController->permissionsList()
#19 D:\wwwroot\pss-2024-fix\web\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#20 D:\wwwroot\pss-2024-fix\web\core\lib\Drupal\Core\Render\Renderer.php(638): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#21 D:\wwwroot\pss-2024-fix\web\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#22 D:\wwwroot\pss-2024-fix\web\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#23 D:\wwwroot\pss-2024-fix\vendor\symfony\http-kernel\HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#24 D:\wwwroot\pss-2024-fix\vendor\symfony\http-kernel\HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#25 D:\wwwroot\pss-2024-fix\web\core\lib\Drupal\Core\StackMiddleware\Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#26 D:\wwwroot\pss-2024-fix\web\core\lib\Drupal\Core\StackMiddleware\KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#27 D:\wwwroot\pss-2024-fix\web\core\lib\Drupal\Core\StackMiddleware\ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#28 D:\wwwroot\pss-2024-fix\web\core\modules\big_pipe\src\StackMiddleware\ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#29 D:\wwwroot\pss-2024-fix\web\core\modules\page_cache\src\StackMiddleware\PageCache.php(106): Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#30 D:\wwwroot\pss-2024-fix\web\core\modules\page_cache\src\StackMiddleware\PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#31 D:\wwwroot\pss-2024-fix\web\core\modules\ban\src\BanMiddleware.php(50): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#32 D:\wwwroot\pss-2024-fix\web\core\lib\Drupal\Core\StackMiddleware\ReverseProxyMiddleware.php(48): Drupal\ban\BanMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#33 D:\wwwroot\pss-2024-fix\web\core\lib\Drupal\Core\StackMiddleware\NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#34 D:\wwwroot\pss-2024-fix\web\core\lib\Drupal\Core\StackMiddleware\AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#35 D:\wwwroot\pss-2024-fix\web\core\lib\Drupal\Core\StackMiddleware\StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#36 D:\wwwroot\pss-2024-fix\web\core\lib\Drupal\Core\DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#37 D:\wwwroot\pss-2024-fix\web\index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#38 {main}
Steps to reproduce
D10.3.10
Entity Print - installed 1.0.1
Give some role access to print "entity print access bundle purchasable_entity"
Then uninstall Entity Print 8.x-2.15
Then try to update any permission on any role.
Proposed resolution
Remove stale permissions in the uninstall procedure.