Problem/Motivation

I've WSOD error after adding the group.

Steps to reproduce

I've installed Group module and related (group+field_group+field_permissions_group), but got this error after creating the first group at /admin/group/types/add:

The website encountered an unexpected error. Please try again later.

Drupal\Core\Field\FieldException: Attempt to create a field without a field_name. in Drupal\field\Entity\FieldConfig->__construct() (line 113 of core/modules/field/src/Entity/FieldConfig.php).
Drupal\Core\Config\Entity\ConfigEntityStorage->doCreate(Array) (Line: 266)
Drupal\Core\Entity\EntityStorageBase->create(Array) (Line: 79)
Drupal\group\Plugin\Group\RelationHandler\GroupMembershipPostInstall->installGroupRolesField(Object, )
call_user_func_array(Array, Array) (Line: 205)
Drupal\group\Entity\GroupRelationshipType->postSave(Object, ) (Line: 597)
Drupal\Core\Entity\EntityStorageBase->doPostSave(Object, ) (Line: 523)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 253)
Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object) (Line: 339)
Drupal\Core\Entity\EntityBase->save() (Line: 608)
Drupal\Core\Config\Entity\ConfigEntityBase->save() (Line: 346)
Drupal\group\Plugin\Group\Relation\GroupRelationTypeManager->installEnforced(Object) (Line: 238)
Drupal\group\Entity\GroupType->postSave(Object, ) (Line: 597)
Drupal\Core\Entity\EntityStorageBase->doPostSave(Object, ) (Line: 523)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 253)
Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object) (Line: 339)
Drupal\Core\Entity\EntityBase->save() (Line: 608)
Drupal\Core\Config\Entity\ConfigEntityBase->save() (Line: 287)
Drupal\group\Entity\Form\GroupTypeForm->save(Array, Object)
call_user_func_array(Array, Array) (Line: 114)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 592)
Drupal\Core\Form\FormBuilder->processForm('group_type_add_form', Array, Object) (Line: 320)
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: 580)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->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: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 707)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

However after the error, the group was created.

Comments

kenorb created an issue. See original summary.

kenorb’s picture

Issue summary: View changes
matslats’s picture

I had this problem after upgrading from v2 to v3, but not when installing v2 fresh.
This and another problem with views, made me realise that quite a bit of upgrade code is needed to compensate for the change of entity name from group_content to group_relationship.

pcate’s picture

I've also ran into this issue when trying to upgrade from v2.3 to v3.3. I can also confirm that upgrading from v2.2.2 to v3.3 does not run into this error.

dbielke1986’s picture

I've also ran into this issue when trying to upgrade from v2.3 to v3.3.

jayelless’s picture

I have just run into this issue when trying to upgrade my site from Group 2 to Group 3. I

I have group 2.3.0 going to group 3.3.0 (along with subgroup from 2.0.2 to 3.0.2 and ginvite from 3.0.0-rc3 to 4.0.0-rc3).

Edit: The problem shows up when using Drush. The particular fields causing the problem are the "group_roles" fields in each of the croup_content membership entity types.

Once the error has been encountered for each membership type then I can run the cache:rebuild without issues. The updatedb command just show "No updates" so don't know why the group module updates are not being executed?

tomklemnyc’s picture

We are running into the same problem with upgrading from 2.2.2 to 3.3.2.

The website encountered an unexpected error. Try again later.
Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException: Circular reference detected for service "router.route_provider", path: "options_request_listener -> router.route_provider -> cache_tags.invalidator -> cache.flexible_permissions_memory -> cache.backend.corefix_memory_no_serialize -> maintenance_mode_subscriber -> url_generator". in Drupal\Component\DependencyInjection\Container->get() (line 149 of core/lib/Drupal/Component/DependencyInjection/Container.php).

kristiaanvandeneynde’s picture

There was an issue with group content types that had long names. Have you tried the latest release? 3.3.3

Also #7 seems completely unrelated to this issue.

j-barnes’s picture

We ran into this issue when upgrading from 2.2.2 to 3.3.3. We realized that we had a drush cr before our drush updatedb.

Following the correct drush deploy sequence fixed our issue.

drush updatedb --no-cache-clear
drush cache:rebuild
drush config:import
drush cache:rebuild
drush deploy:hook
graber’s picture

Version: 3.2.0 » 3.3.3

Just ran into it on 3.3.3 with grequest module.
For me it happened when I had some field storage config that is normally installed by a relationship plugin already installed, reinstalling the plugin caused this error.
Probably some existing config check missing, deleting that storage config resolved the issue.

jepster_’s picture

I've encountered this issue, as I liked to install a groups config via recipe, before the group module was installed. Installing the group module upfront helped.

ericgsmith’s picture

Encountered the same as #9 - error shows up when rebuilding the cache after updating from v2 (I have verified that the deployment identifier changed) but does not show up if updatedb is run before clearing the cache.

The first time the cache is rebuilt I saw an error:

$ drush cr

In EntityTypeManager.php line 142:
                                                             
  The "group_relationship_type" entity type does not exist. 

The second time I see this error:

$ drush cr

In FieldConfig.php line 124:
                                                   
  Attempt to create a field without a field_name.  

As #9 mentions - it looks like drush deploy does not clear the cache before running update db. Our deployment steps do - which can be changed, but curious if this could be hiding an issue. Looking at the issue for the deploy command it looks like it was removed as it wasn't necessary as updatedb runs with a null back backend, and there is no instruction to do it in the drupal update docs either - but from a quick google I can see we probably aren't the only ones doing it - e.g Lullabot.

So perhaps my issue is a deployment order issue given the steps to reproduce are completely different to the issue and other's comments such as #10 - but it might also be highlighting something wrong here.

ruslan piskarov’s picture

The same issue during updating from Group 2.3.2 to 3.3.5.

drush updatedb
[success] No pending updates.

The website encountered an unexpected error. Try again later.
Drupal\Core\Field\FieldException: Attempt to create a field without a field_name. in Drupal\field\Entity\FieldConfig->__construct() (line 124 of core/modules/field/src/Entity/FieldConfig.php).

gallant_dev’s picture

Getting a similar error when trying to upgrade from 2.3.2 to 3.3.5, however the update hooks are registered and partially run. After updating the module with composer, attempting to run drush updatedb results in:

> [notice] Update started: group_update_10304
> [notice] Update completed: group_update_10304
> [notice] Update started: group_update_10305
> [error] assert($field_storage_definition instanceof BaseFieldDefinition)
> [error] Update failed: group_update_10305
[error] Update aborted by: group_update_10305
[error] Finished performing updates.

In FieldConfig.php line 124:
Attempt to create a field without a field name.

Further attempts running updatedb show only the 10305 hook outstanding, but results in a similar error. Running xdebug with a breakpoint on the assert() statement of the update hook in group.install shows the $field_storage_definition variable is null.

karlshea’s picture

Same problem, $field_storage_definition is null.

markdc’s picture

I also cannot complete the database updated while upgrading from 2.3.2 to 3.3.5.

Submodules:
gnode

Contrib modules:
group_action
ginvite

My output:

> [notice] Update started: group_update_10304
> [notice] Update completed: group_update_10304
> [notice] Update started: group_update_10305
> [error] Call to a member function setSetting() on null
> [error] Update failed: group_update_10305
[error] Update aborted by: group_update_10305
[error] Finished performing updates.

How can I get more verbose error messages?

ruslan piskarov’s picture

If you have enabled the "Group Content Moderation" module, try to disable it and remove the "Moderated group content" view (disabling the module doesn't remove it). This has helped me.

Also review web/modules/contrib/group/group.install.
Both Group 2.3.2 and 3.3.5 have group_update_10305().
But Group 2.3.2 doesn't have hooks from group_update_10300() to group_update_10304().
So, if you ran update.php with Group 2.3.2 and group_update_10305() was completed, after updating to Group v3+ hooks from group_update_10300() to group_update_10304(), newer fired.

I hope it will help.

james hawthorn-byng’s picture

I ran drush config:get field.storage.group_relationship.group_roles which reported that the config was missing. Running drush php-eval "\Drupal::service('config.installer')->installDefaultConfig('module', 'group');" fixed the issue for me.

kasey_mk’s picture

Same issues as reported in #14 and elsewhere, trying to update from drupal/group (2.3.2 => 3.3.5) on Drupal 10.6.13.

I've banged my head against any configs that look different from the others. I've tried uninstalling the entitygroupfield module and deleting fields or views with group entity references. I've tried deleting group content, group entities, and even whole group types. As suggested above, I've tried updb/deployment commands in different orders.

Thanks to everyone who's tried something that seemed to work and reported it back here; none of them have helped me (yet) but I live in hope!

kristiaanvandeneynde’s picture

This should be fixed in #3611557: Figure out which core update broke Group2to3UpdateTest.

Essentially, a new core update made it so a hook_update_n installed a module, showing that installing a module before Group has successfully upgraded from v2 to v3 will try to install the group roles field before its storage has been converted.

That issue added a safeguard that does not trigger our module install hook until Group is done upgrading. Please review. and verify if the latest dev version fixes the issue for you.

shelane’s picture

I loaded the dev version of group 3.3 and attempted to run the update locally. I'm still stuck on the same error. I'm running Drupal 10.6.14.

-------- ----------- --------------- -------------------------------------------------------------------------------- 
  Module   Update ID   Type            Description                                                                     
 -------- ----------- --------------- -------------------------------------------------------------------------------- 
  group    10304       hook_update_n   10304 - Make state key for tracking if we came from version 2 clearly defined.  
  group    10305       hook_update_n   10305 - Upgrade group_relationship type ER field.                               
 -------- ----------- --------------- -------------------------------------------------------------------------------- 

>  [notice] Update started: group_update_10304
>  [notice] Update completed: group_update_10304
>  [notice] Update started: group_update_10305
>  [error]  assert($field_storage_definition instanceof BaseFieldDefinition) 
>  [error]  Update failed: group_update_10305 
 [error]  Update aborted by: group_update_10305 
 [error]  Finished performing updates. 

In FieldConfig.php line 124:
                                                   
  Attempt to create a field without a field_name.  
leeksoup’s picture

I am having the same issue with the 3.3.5 release. Also on Drupal 10.6.14

So I tried the dev version hoping the bugfix @kristiaanvandeneynde mentioned would work.

But it fails:

$ drush updb
 -------- ----------- --------------- ----------------------------------------- 
  Module   Update ID   Type            Description                              
 -------- ----------- --------------- ----------------------------------------- 
  group    10304       hook_update_n   10304 - Make state key for tracking if   
                                       we came from version 2 clearly defined.  
  group    10305       hook_update_n   10305 - Upgrade group_relationship type  
                                       ER field.                                
 -------- ----------- --------------- ----------------------------------------- 


 ┌ Do you wish to run the specified pending updates? ───────────┐
 │ Yes                                                          │
 └──────────────────────────────────────────────────────────────┘

>  [notice] Update started: group_update_10304
>  [notice] Update completed: group_update_10304
>  [notice] Update started: group_update_10305
>  [error]  Call to a member function setSetting() on null 
>  [error]  Update failed: group_update_10305 
 [error]  Update aborted by: group_update_10305 
 [error]  Finished performing updates.
kristiaanvandeneynde’s picture

From #21: > [error] assert($field_storage_definition instanceof BaseFieldDefinition)

So that means the "type" field is missing from the group_relationship entity type. Or worse, the entire entity type is missing. Could you debug that last update hook and see what's going on there? It's group_update_10305().

leeksoup’s picture

Re #23 I'm willing to try it when I have some time after this push. Is there a flag to set or do I edit the update hook to add debug info? And if the latter, what would be good to report?