RuntimeException: Adding non-existent permissions to a role is not allowed.

Created on 7 December 2023, 7 months ago
Updated 16 May 2024, about 1 month ago

Problem/Motivation

Permissions granted for a given menu are not removed when that menu is deleted. On Drupal 10.1 at least, when dependencies are calculated (e.g. editing/saving a field), this will result in:

RuntimeException: Adding non-existent permissions to a role is not allowed. The incorrect permissions are "administer menu-site-utrc menu items". in Drupal\user\Entity\Role->calculateDependencies() (line 207 of core/modules/user/src/Entity/Role.php).

Full trace attached β†’ .

Steps to reproduce

  1. Create a menu -- let's call it "Test Menu".
  2. Assign the "Administer Test Menu menu items" to at least one role.
  3. Delete Test Menu.
  4. Visit "Manage fields" for any Content Type and edit any standard field.
  5. Click "Save settings" (you don't have to change anything).
  6. Behold the error.

Proposed resolution

Update the module to define dependencies for the dynamic permissions per this change record β†’ .

Here's the similar issue πŸ› RuntimeException: Adding non-existent permissions to a role is not allowed. Active in Field Permissions (which also defines dynamic custom permissions), with the discussion of a likely solution beginning at #17 πŸ› RuntimeException: Adding non-existent permissions to a role is not allowed. Active .

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States justcaldwell

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @justcaldwell
  • πŸ‡ΊπŸ‡ΈUnited States justcaldwell

    Minor IS edit, and I didn't mean to set to Major.

  • πŸ‡¨πŸ‡ΏCzech Republic parisek

    I have same issue

  • πŸ‡¬πŸ‡§United Kingdom thatlotnextdoor

    Getting the similar Failed: RuntimeException: Adding non-existent permissions to a role is not allowed. The incorrect permissions are "use menu link attributes", "administer menu link attributes". in Drupal\user\Entity\Role->calculateDependencies() (line 207 of [redacted]/web/core/modules/user/src/Entity/Role.php).

    Appeared after updating Drupal 10.0.4 to 10.2.0.

    Grateful for any assistance!!

  • πŸ‡³πŸ‡±Netherlands RicardoPeters

    A workaroud that worked for us, was going to the yaml of the specific role, remove the `administer * menu items` entry and do a config import.

Production build 0.69.0 2024