The UI of a view existing out of 8 block views crashes when I want to edit them. I get the following message in the browser:

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

The logs give me the following errors:

Message Notice: Trying to access array offset on value of type null in Drupal\views\Plugin\views\HandlerBase->getEntityType() (line 710 of /data/sites/web/cinemazedbe/cinemazedbe-live-website/web/core/modules/views/src/Plugin/views/HandlerBase.php)

InvalidArgumentException: A valid cache entry key is required. Use getAll() to get all table data. in Drupal\views\ViewsData->get() (line 140 of /data/sites/web/cinemazedbe/cinemazedbe-live-website/web/core/modules/views/src/ViewsData.php).

I can't edit none of these block views. When I duplicate the view I can access the new duplicated view(s) again but that's not something I want to do because it will mess up my css and js.

Is there a workaround for this problem?

Comments

timme77 created an issue. See original summary.

cilefen’s picture

Issue tags: -UI views crash

How did the View get into this situation?

cilefen’s picture

Also, can you confirm the the Drupal version? There is a comment rather than code on line 710 of core/modules/views/src/Plugin/views/HandlerBase.php in Drupal 7.3.x and Drupal 7.4.x.

cilefen’s picture

Status: Active » Postponed (maintainer needs more info)

One more thing: please get a backtrace.

timme77’s picture

I got in this situation by deleting a relationship that was still using a field or filter that had this relationship.

The version of Drupal is 9.3.14, so I made a mistake there.

This is the whole error:

Notice: Trying to access array offset on value of type null in Drupal\views\Plugin\views\HandlerBase->getEntityType() (line 710 of /data/sites/web/cinemazedbe/cinemazedbe-live-website/web/core/modules/views/src/Plugin/views/HandlerBase.php)
#0 /data/sites/web/cinemazedbe/cinemazedbe-live-website/web/core/includes/bootstrap.inc(346): _drupal_error_handler_real()
#1 /data/sites/web/cinemazedbe/cinemazedbe-live-website/web/core/modules/views/src/Plugin/views/HandlerBase.php(710): _drupal_error_handler()
#2 /data/sites/web/cinemazedbe/cinemazedbe-live-website/web/core/modules/views/src/Plugin/views/filter/Bundle.php(88): Drupal\views\Plugin\views\HandlerBase->getEntityType()
#3 /data/sites/web/cinemazedbe/cinemazedbe-live-website/web/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php(895): Drupal\views\Plugin\views\filter\Bundle->init()
#4 /data/sites/web/cinemazedbe/cinemazedbe-live-website/web/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php(2523): Drupal\views\Plugin\views\display\DisplayPluginBase->getHandlers()
#5 /data/sites/web/cinemazedbe/cinemazedbe-live-website/web/core/modules/views/src/ViewExecutable.php(2112): Drupal\views\Plugin\views\display\DisplayPluginBase->validate()
#6 /data/sites/web/cinemazedbe/cinemazedbe-live-website/web/core/modules/views_ui/src/ViewFormBase.php(128): Drupal\views\ViewExecutable->validate()
#7 /data/sites/web/cinemazedbe/cinemazedbe-live-website/web/core/modules/views_ui/src/ViewFormBase.php(49): Drupal\views_ui\ViewFormBase->getDisplayTabs()
#8 /data/sites/web/cinemazedbe/cinemazedbe-live-website/web/core/lib/Drupal/Core/Entity/EntityForm.php(125): Drupal\views_ui\ViewFormBase->prepareEntity()
#9 /data/sites/web/cinemazedbe/cinemazedbe-live-website/web/core/modules/views_ui/src/ViewFormBase.php(26): Drupal\Core\Entity\EntityForm->init()
#10 /data/sites/web/cinemazedbe/cinemazedbe-live-website/web/core/lib/Drupal/Core/Entity/EntityForm.php(96): Drupal\views_ui\ViewFormBase->init()
#11 /data/sites/web/cinemazedbe/cinemazedbe-live-website/web/core/modules/views_ui/src/ViewFormBase.php(41): Drupal\Core\Entity\EntityForm->buildForm()
#12 [internal function]: Drupal\views_ui\ViewFormBase->buildForm()
#13 /data/sites/web/cinemazedbe/cinemazedbe-live-website/web/core/lib/Drupal/Core/Form/FormBuilder.php(531): call_user_func_array()
#14 /data/sites/web/cinemazedbe/cinemazedbe-live-website/web/core/lib/Drupal/Core/Form/FormBuilder.php(278): Drupal\Core\Form\FormBuilder->retrieveForm()
#15 /data/sites/web/cinemazedbe/cinemazedbe-live-website/web/core/lib/Drupal/Core/Entity/EntityFormBuilder.php(48): Drupal\Core\Form\FormBuilder->buildForm()
#16 /data/sites/web/cinemazedbe/cinemazedbe-live-website/web/core/modules/views_ui/src/Controller/ViewsUIController.php(230): Drupal\Core\Entity\EntityFormBuilder->getForm()
#17 [internal function]: Drupal\views_ui\Controller\ViewsUIController->edit()
#18 /data/sites/web/cinemazedbe/cinemazedbe-live-website/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#19 /data/sites/web/cinemazedbe/cinemazedbe-live-website/web/core/lib/Drupal/Core/Render/Renderer.php(564): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#20 /data/sites/web/cinemazedbe/cinemazedbe-live-website/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext()
#21 /data/sites/web/cinemazedbe/cinemazedbe-live-website/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#22 /data/sites/web/cinemazedbe/cinemazedbe-live-website/web/vendor/symfony/http-kernel/HttpKernel.php(158): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#23 /data/sites/web/cinemazedbe/cinemazedbe-live-website/web/vendor/symfony/http-kernel/HttpKernel.php(80): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#24 /data/sites/web/cinemazedbe/cinemazedbe-live-website/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle()
#25 /data/sites/web/cinemazedbe/cinemazedbe-live-website/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#26 /data/sites/web/cinemazedbe/cinemazedbe-live-website/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#27 /data/sites/web/cinemazedbe/cinemazedbe-live-website/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#28 /data/sites/web/cinemazedbe/cinemazedbe-live-website/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
#29 /data/sites/web/cinemazedbe/cinemazedbe-live-website/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#30 /data/sites/web/cinemazedbe/cinemazedbe-live-website/web/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#31 /data/sites/web/cinemazedbe/cinemazedbe-live-website/web/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle()
#32 /data/sites/web/cinemazedbe/cinemazedbe-live-website/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#33 {main}

Hope this can help you?

cilefen’s picture

Can you get the backtrace for the exception?

timme77’s picture

Here you go:

Drupal\devel\Plugin\Devel\Dumper\DoctrineDebug->export() (Line: 86)
Drupal\devel\DevelDumperManager->export() (Line: 96)
Drupal\devel\DevelDumperManager->message() (Line: 496)
dpm() (Line: 273)
backtrace_error_handler() (Line: 709)
Drupal\views\Plugin\views\HandlerBase->getEntityType() (Line: 88)
Drupal\views\Plugin\views\filter\Bundle->init() (Line: 895)
Drupal\views\Plugin\views\display\DisplayPluginBase->getHandlers() (Line: 2523)
Drupal\views\Plugin\views\display\DisplayPluginBase->validate() (Line: 2112)
Drupal\views\ViewExecutable->validate() (Line: 128)
Drupal\views_ui\ViewFormBase->getDisplayTabs() (Line: 49)
Drupal\views_ui\ViewFormBase->prepareEntity() (Line: 125)
Drupal\Core\Entity\EntityForm->init() (Line: 26)
Drupal\views_ui\ViewFormBase->init() (Line: 96)
Drupal\Core\Entity\EntityForm->buildForm() (Line: 41)
Drupal\views_ui\ViewFormBase->buildForm()
call_user_func_array() (Line: 531)
Drupal\Core\Form\FormBuilder->retrieveForm() (Line: 278)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 48)
Drupal\Core\Entity\EntityFormBuilder->getForm() (Line: 230)
Drupal\views_ui\Controller\ViewsUIController->edit()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 564)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 158)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 80)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->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: 23)
Stack\StackedHttpKernel->handle() (Line: 708)
Drupal\Core\DrupalKernel->handle() (Line: 19)

cilefen’s picture

Did the Views UI allow you to make this change or did you do it some other way?

timme77’s picture

The views UI allowed me to do this.

cilefen’s picture

Status: Postponed (maintainer needs more info) » Active

In terms of getting this view working again, do you happen to have an exported site configuration dating to when it was working?

timme77’s picture

I have a local version of this website indeed, this website is fully functional.

cilefen’s picture

Did you consider exporting and importing the working View configuration?

timme77’s picture

Well I'm not really much a fan of that approach because if something goes wrong, the website will be down and I'll be in trouble.
When I make a duplicate of the view I can maybe rename that duplicate and then delete the broken view? Do you think that that could work?

lendude’s picture

This seems like a duplicate of #3275276: Removing a relationship that is used by a filter can prevent access to editing a view where I tried to reproduce this on a clean install and couldn't. The feedback from the original reporter unfortunately didn't really specify what caused it.

@timme77 is there some way you can reproduce this on a clean install of Drupal? If multiple people report the same problem there seems to be something there, but we really need some steps to reproduce this before we can think about a fix. And if you can find some way, please add it to the older issue so we can keep all findings about this in one issue.