- Issue created by @Grabby
- π³π±Netherlands arantxio Dordrecht
I am also experiencing this issue at the moment, i think the check needs to be changed to "delete any file" instead of "delete files", as it seems this permission doesn't exist. But since we already check for "delete own files" and "delete any files" it can be dropped in general
- Merge request !18Issue #3497284 - remove non existent permission check β (Open) created by arantxio
- π³π±Netherlands arantxio Dordrecht
I've created the above merge request, it worked for me on the first time, but I tried it again and now it doesn't seem to work, so ill have to adjust something first.
- π³π±Netherlands arantxio Dordrecht
I have updated the code to fix the error the problem is the previous code checks for the permission "delete file" but this permission didn't exist, it used to be "delete files" which is the permission its missing because it got removed in the upgrade to 3.0
The merge request fixes the "file_delete_update_400002" update hook to look for the other permission.
This solves the upgrade problem I had.
- First commit to issue fork.
- π§π·Brazil astutonet Sao Paulo, SP
I've also been having this issue on a website.
I initially updated to version 3.0.0 using D10.4.1. However, it was not possible to update the database.
I then downloaded version 3.0.x-dev and when I tried to update the database, the problem repeated itself.
I checked the users' permissions to delete files and tried to remove the permission for authenticated users, but it was not possible.
Looking at the log messages, I see the following errors:
Database Update:
module file_delete
Update 400003Failed: RuntimeException: Adding non-existent permissions to a role is not allowed. The incorrect permissions are "delete files". in function Drupal\user\Entity\Role->calculateDependencies() (line 210 of file /home/username/domains/domain.name.com/public_html/core/modules/user/src/Entity/Role.php).
Recent Log Messages:
#0 /home/username/domains/domain.name.com/public_html/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php(328): Drupal\user\Entity\Role->calculateDependencies()
#1 /home/username/domains/domain.name.com/public_html/core/modules/user/src/Entity/Role.php(182): Drupal\Core\Config\Entity\ConfigEntityBase->preSave()
#2 /home/username/domains/domain.name.com/public_html/core/lib/Drupal/Core/Entity/EntityStorageBase.php(528): Drupal\user\Entity\Role->preSave()
#3 /home/username/domains/domain.name.com/public_html/core/lib/Drupal/Core/Entity/EntityStorageBase.php(483): Drupal\Core\Entity\EntityStorageBase->doPreSave()
#4 /home/username/domains/domain.name.com/public_html/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(257): Drupal\Core\Entity\EntityStorageBase->save()
#5 /home/username/domains/domain.name.com/public_html/core/lib/Drupal/Core/Entity/EntityBase.php(354): Drupal\Core\Config\Entity\ConfigEntityStorage->save()
#6 /home/username/domains/domain.name.com/public_html/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php(617): Drupal\Core\Entity\EntityBase->save()
#7 /home/username/domains/domain.name.com/public_html/core/modules/user/user.module(1031): Drupal\Core\Config\Entity\ConfigEntityBase->save()
#8 /home/username/domains/domain.name.com/public_html/core/modules/user/user.module(989): user_role_revoke_permissions()
#9 /home/username/domains/domain.name.com/public_html/core/modules/user/src/Form/UserPermissionsForm.php(257): user_role_change_permissions()
#10 [internal function]: Drupal\user\Form\UserPermissionsForm->submitForm()
#11 /home/username/domains/domain.name.com/public_html/core/lib/Drupal/Core/Form/FormSubmitter.php(129): call_user_func_array()
#12 /home/username/domains/domain.name.com/public_html/core/lib/Drupal/Core/Form/FormSubmitter.php(67): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers()
#13 /home/username/domains/domain.name.com/public_html/core/lib/Drupal/Core/Form/FormBuilder.php(597): Drupal\Core\Form\FormSubmitter->doSubmitForm()
#14 /home/username/domains/domain.name.com/public_html/core/lib/Drupal/Core/Form/FormBuilder.php(326): Drupal\Core\Form\FormBuilder->processForm()
#15 /home/username/domains/domain.name.com/public_html/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm()
#16 [internal function]: Drupal\Core\Controller\FormController->getContentResult()
#17 /home/username/domains/domain.name.com/public_html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#18 /home/username/domains/domain.name.com/public_html/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#19 /home/username/domains/domain.name.com/public_html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext()
#20 /home/username/domains/domain.name.com/public_html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#21 /home/username/domains/domain.name.com/public_html/vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#22 /home/username/domains/domain.name.com/public_html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#23 /home/username/domains/domain.name.com/public_html/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()
#24 /home/username/domains/domain.name.com/public_html/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#25 /home/username/domains/domain.name.com/public_html/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#26 /home/username/domains/domain.name.com/public_html/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()
#27 /home/username/domains/domain.name.com/public_html/core/modules/page_cache/src/StackMiddleware/PageCache.php(116): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
#28 /home/username/domains/domain.name.com/public_html/core/modules/page_cache/src/StackMiddleware/PageCache.php(90): Drupal\page_cache\StackMiddleware\PageCache->pass()
#29 /home/username/domains/domain.name.com/public_html/core/modules/ban/src/BanMiddleware.php(50): Drupal\page_cache\StackMiddleware\PageCache->handle()
#30 /home/username/domains/domain.name.com/public_html/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\ban\BanMiddleware->handle()
#31 /home/username/domains/domain.name.com/public_html/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#32 /home/username/domains/domain.name.com/public_html/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#33 /home/username/domains/domain.name.com/public_html/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
#34 /home/username/domains/domain.name.com/public_html/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#35 /home/username/domains/domain.name.com/public_html/index.php(19): Drupal\Core\DrupalKernel->handle()
#36 {main}Can someone help us, pls? Tks!
- π©πͺGermany kreatIL
I am experiencing the same issue as described here. I have tested this with the latest 3.x-dev version of the module, but the problem persists. Drupal 10.3.10 in my usecase.
Additionally, I have created a patch based on the changes provided in commit #6 and applied it to my site. Unfortunately, the error still occurs after applying the patch.
Updating the status of this issue to "needs work"
- π§πͺBelgium flyke
I have no idea why this patch does not work.
It applies.
I can see in web/modules/contrib/file_delete/file_delete.install inside file_delete_update_400003() that there is absolutely no'delete files'
in that code. Yet, if I try runningdrush updb -y
, then I always get the error> [notice] Update started: file_delete_update_400003 > [error] Adding non-existent permissions to a role is not allowed. The incorrect permissions are "delete files". > [error] Update failed: file_delete_update_400003
It makes no sense. I cleared caches multiple times, I restarted my local project, I emptied cache tables, I do not get why the error references a problem with
'delete files'
whle that is not literally in the codefunction file_delete_update_400003(): void { $roles = Role::loadMultiple(); foreach ($roles as $role) { if ($role->hasPermission('delete own files') || $role->hasPermission('delete any files')) { $role->grantPermission('delete files override usage'); $role->grantPermission('delete files immediately'); $role->save(); } } }
So to fix this, I just exported my config using
drush cex -y
, then I searched in my config folder fordelete files
, which was inside a user.role.somerolename.yml file. I deleted that line and imported my config usingdrush cim -y
and after that I had no problem runningdrush updb -y
. Lastly, I edited the role via the admin UI to give back the delete files permissions. - π©πͺGermany kreatIL
I have implemented the solution outlined in comment #12 and can confirm that it successfully bypasses the error message, allowing updb to run without any issues.
- π³π±Netherlands arantxio Dordrecht
The problem lies in the fact that you probably already ran the updb script before adding the patch, as you found out about it later, i've added it in such a way that it has to run the previous updates first.
The workaround you mentioned also works yes, remove the permission directly from the config, you can do this if you already ran the updb scripts before adding the updated patch.
- π³π±Netherlands arantxio Dordrecht
Here is a patch for people that already ran the previous update, this should edit the permission table so you dont have any problems.
Let me know if it works for you as I don't have project to test it on anymore.
P.S. this is not the official fix! The official fix is the merge request, as it should be fixed in the main branch before people are actually updating.
- π§πͺBelgium fernly
This is a static patch of the current approved merge request for people wanting to add it to there project.
- πΊπΈUnited States laura.gates
I'm also getting the following error upgrading to v3.0.0 with Drupal 10.4.x
> [error] /var/www/html/docroot/modules/contrib/file_delete/file_delete.permissions.yml: Duplicate key "delete files override usage" detected at line 11.
> [error] Update failed: file_delete_update_400002
[error] Update aborted by: block_class_update_20017, file_delete_update_400002
[error] Finished performing updates.I applied patch #16 and it is successful.
- Status changed to RTBC
29 days ago 10:16pm 7 March 2025 - π©πͺGermany Duwid
The error also occurs with the
delete files settings
permission. In my case, the admin role had this permission. I was able to fix it by revoking the permission manually before running the database update, but this should be handled by the update hook.