Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
When uninstalling the module (installed previously on a vanilla 8.1.x Drupal), the following error pops up:
$ drush pmu file_entity -y
The following extensions will be uninstalled: file_entity
Do you really want to continue? (y/n): y
exception 'Drupal\Core\Field\FieldException' with message 'Attempt to create a field field_image_alt_text that does not [error]
exist on entity type file.' in /core/modules/field/src/Entity/FieldConfig.php:286
Stack trace:
#0 core/modules/field/src/Entity/FieldConfig.php(201):
Drupal\field\Entity\FieldConfig->getFieldStorageDefinition()
#1 core/lib/Drupal/Core/Entity/EntityStorageBase.php(357):
Drupal\field\Entity\FieldConfig::preDelete(Object(Drupal\field\FieldConfigStorage), Array)
#2 core/lib/Drupal/Core/Entity/Entity.php(366):
Drupal\Core\Entity\EntityStorageBase->delete(Array)
#3 core/lib/Drupal/Core/Config/ConfigManager.php(203):
Drupal\Core\Entity\Entity->delete()
#4 core/lib/Drupal/Core/Extension/ModuleInstaller.php(391):
Drupal\Core\Config\ConfigManager->uninstall('module', 'file_entity')
#5 core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php(91):
Drupal\Core\Extension\ModuleInstaller->uninstall(Array, true)
#6 ~/.composer/vendor/drush/drush/commands/core/drupal/environment.inc(227):
Drupal\Core\ProxyClass\Extension\ModuleInstaller->uninstall(Array)
#7 ~/.composer/vendor/drush/drush/commands/core/drupal/pm_8.inc(82): drush_module_uninstall(Array)
#8 ~/.composer/vendor/drush/drush/commands/pm/pm.drush.inc(1237): _drush_pm_uninstall(Array)
#9 [internal function]: drush_pm_uninstall('file_entity')
#10 ~/.composer/vendor/drush/drush/includes/command.inc(366): call_user_func_array('drush_pm_uninst...', Array)
#11 ~/.composer/vendor/drush/drush/includes/command.inc(217): _drush_invoke_hooks(Array, Array)
#12 [internal function]: drush_command('file_entity')
#13 ~/.composer/vendor/drush/drush/includes/command.inc(185): call_user_func_array('drush_command', Array)
#14 ~/.composer/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(72): drush_dispatch(Array)
#15 ~/.composer/vendor/drush/drush/includes/preflight.inc(68): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#16 ~/.composer/vendor/drush/drush/drush.php(12): drush_main()
#17 {main}
Proposed resolution
Fix it.
Workaround: run drush pm-uninstall file_entity
twice.
Remaining tasks
None.
User interface changes
None.
API changes
None.
Data model changes
None.
Comments
Comment #2
martin.knapp CreditAttribution: martin.knapp as a volunteer commentedAfter uninstalling on a vanilla D-8.1.9 site, via the admin interface, my site displays WSOD. In the Apache error log there is this:
Uncaught PHP Exception Drupal\\Core\\Database\\DatabaseExceptionWrapper: "Exception in Frontpage[frontpage]: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'base.type' in 'field list': SELECT base.fid AS fid, base.type AS type, base.uuid AS uuid, base.langcode AS langcode, base.uid AS uid, base.filename AS filename, base.uri AS uri, base.filemime AS filemime, base.filesize AS filesize, base.status AS status, base.created AS created, base.changed AS changed\nFROM \n{file_managed} base\nWHERE (base.fid IN (:db_condition_placeholder_0)); Array\n(\n [:db_condition_placeholder_0] => 4\n)\n" at D:\\AcquiaSites\\drupal8\\core\\modules\\views\\src\\Plugin\\views\\query\\Sql.php line 1488
Comment #3
nicrodgersComment #4
MartinMa CreditAttribution: MartinMa as a volunteer commentedI just had this problem too!
I also had the problem to uninstall file field paths module after running the sql-statement "UPDATE file_managed SET origname = null", I could uninstall file entity
see: https://www.drupal.org/node/2685731
Maybe this can help to find the source of the problems.
Comment #5
Falco010Having the same issue. When I uninstall the module I get the 'Attempt to create a field field_image_alt_text' error.
Due to the fact that file_entity is not compatible with Configuration Management, this is a blocker for me. Because we need to uninstall the module in our deploy script before running drush cim.
see: https://www.drupal.org/node/2895530
Comment #6
Falco010Comment #7
pminfI also get the error message and had to run
drush pm-uninstall file_entity
twice to uninstall successfully (as far as I can tell). So it does break our deploy script too.@MartinMa (#4): There is no column origname in file_managed (might be specific to File (Field) Paths).
Comment #8
sorina.hriban CreditAttribution: sorina.hriban commentedI have the same problem when uninstalling the module. My site crashes. Also, I have seen that when installing the module, first I encounter an error.
Comment #9
benjifisherComment #10
Raman Starshykh CreditAttribution: Raman Starshykh at EPAM Systems commentedComment #11
linichalexey CreditAttribution: linichalexey at EPAM Systems commentedComment #12
jigariusI'd recommend that you delete those fields associated to "file entity" before you uninstall the "file_entity" module. Also, the file.type field is not uninstalled cleanly at the moment. I've submitted a patch for the same on Issue 3033883.
Comment #13
lukusI'm experiencing the same problem at the moment.
If I delete the fields added by the module, the error mentioned is avoided.
However, I end up with:
PHP Fatal error: Uncaught TypeError: Argument 3 passed to Drupal\views\EntityViewsData::mapFieldDefinition() must implement interface Drupal\Core\Field\FieldDefinitionInterface, null given, called in /app/web/core/modules/views/src/EntityViewsData.php on line 290 and defined in /app/web/core/modules/views/src/EntityViewsData.php:387
Comment #14
Andrew Answer CreditAttribution: Andrew Answer as a volunteer commented@lukus, with this patch you aviod this error, but you should remove fields by hand before uninstallation.
Comment #15
BerdirThis should be much better now with the fixes I did in #3033883: Error: Mismatched entity and/or field definitions after uninstalling the module, please create new issues if you find specific problems, which is quite likely. Make sure to read my comments there before you start, and I assume you want to migrate your data to media entities before you uninstall this, unless you just installed this for testing (but you shouldn't do that on a production environment or at least not without a backup).