The "comment" entity type does not exist

Created on 29 October 2019, almost 5 years ago
Updated 30 April 2024, 4 months ago

Hello,

I had an error and like to report it for everyone who has the same problem.
Maybe you can do the same steps I did and solve the problem, ore be inspired how to solve this issue in your setup.

After an upgrade to Drupal Core 8.7.8 there were messages in the 'recent log messages' (/admin/reports/dblog). They appear after a cron run.

This are the messages:

- A warnig: Cannot remove field comment_body because the entity type is unknown: comment

- And a error: Drupal\Component\Plugin\Exception\PluginNotFoundException: The "comment" entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition() (line 150 of /httpdocs/core/lib/Drupal/Core/Entity/EntityTypeManager.php)

I know there are some issues 'Drupal\Component\Plugin\Exception\PluginNotFoundException' bud I found none of them with explicit "The "comment" entity type does not exist". The solutions found there didn't work for me so I had to dig further..

Good to know about my setup: I don't used the standard entity- types (as Article) and I 'shut down' (unselect) the module 'comments' in all my projects. Just to have some less vulnerability without the links and forms it could create.

After a couple of hours searching I found where the problem was; a config-thing in content type 'article', there was a config about 'comment'. So when I saw that, I did:
-delete the ' Article' content type. (for my config this was easy, because not in use. Lucky me)
- install the 'comment' module
- de-install the 'comment' module (this moment is where all config from 'comment' is removed, what I wanted)
Maybe after every step run /update.php.

Delete the involved content-type was not enough. Install/deinstall the 'comment' module either. I had to do both. And run update.php

After this action when cron run the warning and error didn't show up anymore.

So for me this issues are time consuming. So this post is for everyone who has the same issue and may know how to solve it, or at least have a better idea how to do this or where to search in your setup. So your effort to overcome this issue takes (much) less time.
Succes!

Have a nice day,
Marcel

πŸ› Bug report
Status

Fixed

Version

10.0 ✨

Component
Configuration entityΒ  β†’

Last updated 2 days ago

Created by

πŸ‡³πŸ‡±Netherlands MLZR Zutphen

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡¦Ukraine vlad.dancer Kyiv

    I would also add that if you decided to turn off comment module after migrating old content with comments then you might get troubles with πŸ’¬ How to fix "non-existent config entity name returned by FieldStorageConfigInterface::getBundles()" Needs work and you can adapt code from #25 β†’
    But then you'll might have config/state leftovers in database that will cause 'The "comment" entity type does not exist' on each cache rebuild.
    So search your key_value table for comment related records and delete them:
    SELECT `collection`, `name`, `value` FROM `key_value` WHERE `name` LIKE '%comment%' LIMIT 0,1000;

  • πŸ‡ΊπŸ‡ΈUnited States jayemel

    Is this fixed? I am seeing this on cron runs after uninstalling paragraphs.

    Drupal\Component\Plugin\Exception\PluginNotFoundException: The "paragraph" entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition() (line 139 of /code/web/core/lib/Drupal/Core/Entity/EntityTypeManager.php).
    

    Reinstalling, running cron, uninstalling is not an option on 30+ sites, nor is editing the database. Any other suggestions?

    The module was uninstalled the correct way, removed any entities, config, etc., then uninstalled. Module uninstalled fine, but this persistent error throw during cron runs.

Production build 0.71.5 2024