Hi,

I have upgraded group module from version 2.2 to 3.3. The upgrade went well. But the admin module uninstall page `/admin/modules/uninstall` is not working. I have tried the commands `drush cr` and `drush updb` but still no luck.

The error is

The website encountered an unexpected error. Try again later.

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

Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem::propertyDefinitions(Object) (Line: 590)
Drupal\Core\Field\BaseFieldDefinition->getPropertyDefinitions() (Line: 269)
Drupal\Core\Entity\Query\Sql\Tables->addField('type', 'INNER', NULL) (Line: 58)
Drupal\Core\Entity\Query\Sql\Condition->compile(Object) (Line: 177)
Drupal\Core\Entity\Query\Sql\Query->compile() (Line: 82)
Drupal\Core\Entity\Query\Sql\Query->execute() (Line: 91)
Drupal\group\UninstallValidator\GroupRelationshipUninstallValidator->hasRelationships('group_membership') (Line: 58)
Drupal\group\UninstallValidator\GroupRelationshipUninstallValidator->validate('group') (Line: 650)
Drupal\Core\Extension\ModuleInstaller->validateUninstall(Array) (Line: 99)
Drupal\Core\ProxyClass\Extension\ModuleInstaller->validateUninstall(Array) (Line: 161)
Drupal\system\Form\ModulesUninstallForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 536)
Drupal\Core\Form\FormBuilder->retrieveForm('system_modules_uninstall', Object) (Line: 284)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 68)
Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 53)
Asm89\Stack\Cors->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 741)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
CommentFileSizeAuthor
#2 2024-12-14_16-28-43.png16.93 KBljwilson

Comments

chandraraj created an issue. See original summary.

ljwilson’s picture

StatusFileSize
new16.93 KB

I have the exact same issue. I tracked it down to two records in the key_value table which still have a reference to group_content_type instead of group_relationship_type. This sql finds them:

SELECT * FROM key_value WHERE collection LIKE '%entity.definitions.installed%' AND VALUE LIKE '%group_content_type%'

SQL Results

Fortunately I had another site where I had started with Group 3.x initially, so I just replaced the value field for those 2 records in the problem site's db with the ones from the "good" site.

I did a compare on those values first, and it looked "safe" enough to make this change. Time will tell.

My stack trace is slightly different:

The website encountered an unexpected error. Try again later.

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "group_content_type" entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition() (line 142 of core\lib\Drupal\Core\Entity\EntityTypeManager.php).
Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem::propertyDefinitions() (Line: 590)
Drupal\Core\Field\BaseFieldDefinition->getPropertyDefinitions() (Line: 269)
Drupal\Core\Entity\Query\Sql\Tables->addField() (Line: 58)
Drupal\Core\Entity\Query\Sql\Condition->compile() (Line: 177)
Drupal\Core\Entity\Query\Sql\Query->compile() (Line: 82)
Drupal\Core\Entity\Query\Sql\Query->execute() (Line: 91)
Drupal\group\UninstallValidator\GroupRelationshipUninstallValidator->hasRelationships() (Line: 58)
Drupal\group\UninstallValidator\GroupRelationshipUninstallValidator->validate() (Line: 650)
Drupal\Core\Extension\ModuleInstaller->validateUninstall() (Line: 99)
Drupal\Core\ProxyClass\Extension\ModuleInstaller->validateUninstall() (Line: 161)
Drupal\system\Form\ModulesUninstallForm->buildForm()
call_user_func_array() (Line: 536)
Drupal\Core\Form\FormBuilder->retrieveForm() (Line: 284)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
Drupal\Core\Controller\FormController->getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 741)
Drupal\Core\DrupalKernel->handle() (Line: 19)

...jack

muaz7731’s picture

Having the same issue here. following

ljwilson’s picture

A better fix might be from The "group_content_type" entity type does not exist error after upgrade from v2 to v3
https://www.drupal.org/project/group/issues/3494298

I backed-out my db changes and applied the code from the above issue and it also fixes the uninstall error.

To easily run the code referenced, I created a file update_field_storage.php in the group module folder with the following contents, and ran it with drush scr update_field_storage.php

<?php

use Drupal\Core\Entity\EntityDefinitionUpdateManagerInterface;
use Drush\Drush;

$field_def = \Drupal::entityDefinitionUpdateManager()->getFieldStorageDefinition('type', 'group_relationship');

// Get the Symfony Console Output interface from Drush.
$output = Drush::output();

if ($field_def) {
    $field_def->setSetting('target_type', 'group_relationship');
    \Drupal::entityDefinitionUpdateManager()->updateFieldStorageDefinition($field_def);

    // Print success message to the console.
    $output->writeln('<info>Field storage definition updated successfully.</info>');
} else {
    // Print error message to the console.
    $output->writeln('<error>Field storage definition not found.</error>');
}

...jack

muaz7731’s picture

Thanks @ljwilson. Uninstall page now accessible

elimw’s picture

@ljwilson, for me, the issue wasn't related to an uninstall page, but I tried your fix and it worked for me.

Could you refactor your fix into an update hook?

pcate’s picture

The code in #4 or https://www.drupal.org/project/group/issues/3494298 seems to fix the uninstall page issue and replaces the group_content_type references in the group_relationship.field_storage_definitions key_value table entry, but I'm still seeing group_content_type references in the the group_relationship_type.entity_type entry @ljwilson shows in #2..

kristiaanvandeneynde’s picture

Okay I think we forgot to update the base field definition for the "type" field on the "group_relationship" entity type. Need to investigate, but that seems like the most logical explanation.

kristiaanvandeneynde’s picture

Even though the other issue is more recent, I'm going to close this one as a duplicate because the other one has a working fix and correctly identified the issue as the base field not having been updated. Will carry over credit to that one.