I am getting the below error when accessing the view edit form

The website encountered an unexpected error. Try again later.

InvalidArgumentException: "0" is an invalid render array key. Value should be an array but got a string. in Drupal\Core\Render\Element::children() (line 97 of core/lib/Drupal/Core/Render/Element.php).

Drupal\Core\Render\Renderer->doRender() (Line: 248)
Drupal\Core\Render\Renderer->render() (Line: 165)
Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 164)
Drupal\Core\Render\Renderer->renderInIsolation() (Line: 214)
Drupal\entityreference_filter\Plugin\views\filter\EntityReferenceFilterViewResult->processOptions() (Line: 194)
Drupal\entityreference_filter\Plugin\views\filter\EntityReferenceFilterViewResult->getConfiguredViewsOptions() (Line: 155)
Drupal\entityreference_filter\Plugin\views\filter\EntityReferenceFilterViewResult->getValueOptions() (Line: 418)
Drupal\views\Plugin\views\filter\InOperator->validate() (Line: 2545)
Drupal\views\Plugin\views\display\DisplayPluginBase->validate() (Line: 530)
Drupal\views\Plugin\views\display\PathPluginBase->validate() (Line: 555)
Drupal\views\Plugin\views\display\Page->validate() (Line: 2161)
Drupal\views\ViewExecutable->validate() (Line: 129)
Drupal\views_ui\ViewFormBase->getDisplayTabs() (Line: 50)
Drupal\views_ui\ViewFormBase->prepareEntity() (Line: 126)
Drupal\Core\Entity\EntityForm->init() (Line: 27)
Drupal\views_ui\ViewFormBase->init() (Line: 97)
Drupal\Core\Entity\EntityForm->buildForm() (Line: 42)
Drupal\views_ui\ViewFormBase->buildForm()
call_user_func_array() (Line: 536)
Drupal\Core\Form\FormBuilder->retrieveForm() (Line: 284)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 48)
Drupal\Core\Entity\EntityFormBuilder->getForm() (Line: 220)
Drupal\views_ui\Controller\ViewsUIController->edit()
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: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
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)
CommentFileSizeAuthor
#3 views.view_.Facility_Info.yml106.45 KBanish.a
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

anish.a created an issue. See original summary.

maximkashuba’s picture

hi anisha,
could you tell me more the details about the bug, how to reproduce it.
Is it after update to 2.0.0-beta5 ?
what is the current version of the module you use?

anish.a’s picture

Version: 2.0.x-dev » 2.0.0-beta5
StatusFileSize
new106.45 KB

I am using 2.0.0-beta5.

I am not sure whether it happened after the beta. I think I selected some wrong options and got locked out of the page.

These are the warnings I was seeing in the Drupal messages.

Warning: Undefined array key "#row" in Drupal\entityreference_filter\Plugin\views\filter\EntityReferenceFilterViewResult->processOptions() (line 211 of modules/contrib/entityreference_filter/src/Plugin/views/filter/EntityReferenceFilterViewResult.php).

Error message
Warning: Attempt to read property "_entity" on null in Drupal\entityreference_filter\Plugin\views\filter\EntityReferenceFilterViewResult->processOptions() (line 211 of modules/contrib/entityreference_filter/src/Plugin/views/filter/EntityReferenceFilterViewResult.php).

I tried debugging and found that this is getting as $renderable in processOptions. This obviously is not the array it is expecting.

Array
(
    [0] => views_view__entity_reference_view__entityreference_4
    [1] => views_view__entityreference_4
    [2] => views_view__default
    [3] => views_view__entity_reference_view__default
    [4] => views_view__default
    [5] => views_view__entity_reference_view
    [6] => views_view
)

I am stuck here. Sending the configuration file for the view.

maximkashuba’s picture

Version: 2.0.0-beta5 » 2.0.x-dev
Priority: Major » Normal
Status: Active » Needs review

Hi @anish.a,

Thanks for reporting this and for the debugging details, and sorry it took me so long to get back to you.

The root cause is that the filter's reference_display (entity_reference_view:entityreference_4) points to a display that is not of the Entity Reference type. Only an Entity Reference display returns its results as rows keyed by entity id, which is what the filter expects. Any other display type (page, block, default) renders the whole view as a single render array. The filter then walked its keys (#theme, #view, …) as if they were rows. That is where the Undefined array key "#row" warnings and the "0" is an invalid render array key exception came from. Since this happens while Views UI validates the filter, the whole view edit form became inaccessible.

The filter settings form only lists Entity Reference displays, so such a value can't be selected there directly. Most likely the configuration got into this state outside the form: through manual config editing or import, or a migration. The display id entityreference_4 also differs from the entity_reference_N ids that Views UI generates.

Still, a configuration like this should not lock you out of the view. I've added a runtime check of the display type. If the configured reference display is not an Entity Reference display, the filter no longer tries to build options from it. It returns no options, and a warning is logged:

▎ The display %display_id of the view %view_name is not an Entity Reference display.

The view edit form opens again, and you can point the filter to a proper Entity Reference display. A kernel test covers this case.
The fix is ready in MR !32. Ready for review.