Permission rename in <module_name>.permissions.yml leads to "RuntimeException: Adding non-existent permissions to a role is not allowed" error

Created on 2 January 2025, 20 days ago

Problem/Motivation

Renaming a permission in .permissions.yml leads to "RuntimeException: Adding non-existent permissions to a role is not allowed" error.

The old permission name is still in the database's config table and drush role:list, but trying to remove it with drush commands does not help since they do not find it for some reason.

Clearing the cache with Drush also doesn't help.

The only workaround I see is adding the old permission name as a new, separate role in .permissions.yml, uninstalling my custom module, changing .permissions.yml, and re-installing it.

Steps to reproduce

1. Define a permission in .permissions.yml;
2. Go to People->Permissions and assign permission to specific roles;
3. Go to the .permissions.yml file and rename the permission;
4. Go back to People->Permissions, try saving with no or minimal changes.

🐛 Bug report
Status

Active

Version

11.0 🔥

Component

user.module

Created by

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

Comments & Activities

Production build 0.71.5 2024