FieldException: Attempt to create a field without a field_name

Created on 3 October 2023, over 1 year ago

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)
πŸ› Bug report
Status

Active

Version

3.2

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom kenorb

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

Comments & Activities

  • Issue created by @kenorb
  • πŸ‡¬πŸ‡§United Kingdom kenorb
  • 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.

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

    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.

  • πŸ‡©πŸ‡ͺGermany dbielke1986

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

  • πŸ‡³πŸ‡ΏNew Zealand jlscott

    I have just run into this issue when trying to upgrade my site from Group 2 to Group. 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).

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

    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).

  • πŸ‡§πŸ‡ͺBelgium kristiaanvandeneynde Antwerp, Belgium

    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.

  • πŸ‡ΊπŸ‡ΈUnited States j-barnes

    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
    
  • πŸ‡΅πŸ‡±Poland Graber

    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.

  • πŸ‡©πŸ‡ͺGermany Peter Majmesku πŸ‡©πŸ‡ͺDΓΌsseldorf

    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.

  • πŸ‡³πŸ‡ΏNew Zealand ericgsmith

    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.

Production build 0.71.5 2024