Deleted Field Prevents Creating New Field with the Same Label Name

Created on 12 January 2024, 10 months ago
Updated 20 March 2024, 8 months ago

summary problem motivation

A field was deleted successfully. If creating a new filed with the same label but different machine name, then error occurs:

RuntimeException: Adding non-existent permissions to a role is not allowed. The incorrect permissions are "view my_deleted_field_name". in Drupal\user\Entity\Role->calculateDependencies() (line 207 of /Users/mylaptopname/drupal/core/modules/user/src/Entity/Role.php).

Steps to reproduce

I have tested this problem multiple times. You can reproduce as below:

  1. Create a new field, say "field_explain" with field label as "Explain". It doesn't matter what field type it is;
  2. without entering any data, delete this field "field_explain". So far so good;
  3. Create a new field, say "field_new_explain" with the same field label as "Explain". Make sure the label is the same as the deleted one. We can make the field type the same as the deleted one, too.
  4. Try to assign private permission, then click save.
  5. Now you will see the expected error warning and get the error message in report

Proposed resolution

What I do to correct this is to add the deleted field back in with different label name, and then deleted it again. Now go back to the new field that I wanted to create and assign correction field permission. Now things back to normal.

Although this bug may not be experienced by many, it still a bug to fix.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Closed: cannot reproduce

Version

1.0

Component

User interface

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