We recently migrated successfully in our drupal 8 instance from field collection module (latest alpha) to paragraphs. Now I am trying to remove the field collection module from our drupal instance, but it cant be removed as it is "used in the field field_collection_item.field_sprechzeiten_zeitraum" (see screenshot from uninstall view).

uninstalling field_collection is prevented

When I try to delete this field field_sprechzeiten_zeitraum, the following error message is displayed:

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'druco_stage.field_collection_item__field_sprechzeiten_zeitraum' doesn't exist: SELECT 'entity_id' FROM {field_collection_item__field_sprechzeiten_zeitraum} WHERE 'bundle' = 'field_sprechzeiten'; Array ( ) in field_collection_field_config_predelete() (line 95 of modules/contrib/field_collection/field_collection.module).

It looks like somebody had tried to delete this earlier and something went wrong, as the database entry was deleted but not all the other references or the entry was not created in the first place.

As I am no drupal dev and just administrating this site, I am quite clueless, how to deal with it. I just want the field_collection module to be gone, has anyone an idea how to solve this problem?


Do you have any old database backups? You could spin up a copy of the site in a local development environment and restore an old version of the database to see whether the missing tables can be recreated, allowing you to remove the field_collection module.

Generally, it is a bad idea to make such changes directly in the database (which is likely what someone did to create the problem in the first place) but you may be able to create an empty table with the same structure by analyzing the table in the old backup:

DESCRIBE field_collection_item__field_sprechzeiten_zeitraum;

Armed with this information, you may be able to create a matching table structure in the production database -- again, working in a local copy rather than on the production server.

If no suitable backups are available, you may be able to use the field_collection module to add the field_collection_item__field_sprechzeiten_zeitraum to the field_sprechzeiten bundle. (You won't be able to recreate the field contents this way, but you are just trying to delete it anyway.)

Once the missing table exists (even if it is empty) you may be able to remove the field without error and uninstall the module. Good luck.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.