I am unable to add a new user. I get the following error when I press "Add User" button:

Drupal\Core\Entity\Query\QueryException: 'field_housing_coop_ref' not found in Drupal\Core\Entity\Query\Sql\Tables->ensureEntityTable() (line 252 of core/lib/Drupal/Core/Entity/Query/Sql/Tables.php).

'field_housing_coop_ref' was an entity reference field (pointing to Content Type A) on Content Type B. This 'field_housing_coop_ref' field is now deleted. It only existed on Content Type B. I deleted it from Content Type B and it no longer appears on the 'Field list' page.

I do have an entity reference field on the user account configuration which does point to the same Content Type A as the field mentioned in the error. This is called 'field_person_coop'. I cannot see how this is related but thought it enough of a coincidence to mention.

I have marked this issue as support because I am not experienced enough to be certain this is a bug. Any advice how to fix this appreciated. I am more than happy to provide any more info it it will help. Here is the full error:

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

Drupal\Core\Entity\Query\QueryException: 'field_housing_coop_ref' not found in Drupal\Core\Entity\Query\Sql\Tables->ensureEntityTable() (line 252 of core/lib/Drupal/Core/Entity/Query/Sql/Tables.php).

Drupal\Core\Entity\Query\Sql\Tables->addField('field_housing_coop_ref', 'LEFT', NULL) (Line: 286)
Drupal\Core\Entity\Query\Sql\Query->getSqlField('field_housing_coop_ref', NULL) (Line: 187)
Drupal\Core\Entity\Query\Sql\Query->addSort() (Line: 87)
Drupal\Core\Entity\Query\Sql\Query->execute() (Line: 250)
Drupal\Core\Entity\Plugin\EntityReferenceSelection\DefaultSelection->getReferenceableEntities() (Line: 532)
Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem->getSettableOptions(Object) (Line: 121)
Drupal\Core\Field\Plugin\Field\FieldWidget\OptionsWidgetBase->getOptions(Object) (Line: 39)
Drupal\Core\Field\Plugin\Field\FieldWidget\OptionsSelectWidget->formElement(Object, 0, Array, Array, Object) (Line: 329)
Drupal\Core\Field\WidgetBase->formSingleElement(Object, 0, Array, Array, Object) (Line: 90)
Drupal\Core\Field\WidgetBase->form(Object, Array, Object) (Line: 173)
Drupal\Core\Entity\Entity\EntityFormDisplay->buildForm(Object, Array, Object) (Line: 59)
Drupal\Core\Entity\ContentEntityForm->form(Array, Object, Object) (Line: 274)
Drupal\user\AccountForm->form(Array, Object, Object) (Line: 60)
Drupal\user\RegisterForm->form(Array, Object) (Line: 120)
Drupal\Core\Entity\EntityForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 517)
Drupal\Core\Form\FormBuilder->retrieveForm('user_register_form', Object) (Line: 276)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 79)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 128)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 577)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 129)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 102)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 139)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 62)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 62)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 103)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 82)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 55)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 637)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Comments

Polly created an issue. See original summary.

rteijeiro’s picture

Status: Active » Closed (cannot reproduce)

Tested it and it seems to work well. Probably it's just a problem in your content types configuration but it doesn't seem to be a problem in the user module.

Try to re-create the content types in a new clean Drupal installation and check if you can reproduce the error.

Polly’s picture

OK, thanks.