AssertionError: #lazy_builder callbacks must return a valid renderable array

Created on 4 June 2024, 27 days ago

Problem/Motivation

    The website encountered an unexpected error. Try again later.
AssertionError: #lazy_builder callbacks must return a valid renderable array, got NULL from Drupal\views_block_with_lazy_builder\Plugin\Block\ViewsBlockWithLazyBuilder::viewsBlockWithLazyBuilderCallback in assert() (line 403 of core/lib/Drupal/Core/Render/Renderer.php).
assert(, '#lazy_builder callbacks must return a valid renderable array, got NULL from Drupal\views_block_with_lazy_builder\Plugin\Block\ViewsBlockWithLazyBuilder::viewsBlockWithLazyBuilderCallback') (Line: 403)
Drupal\Core\Render\Renderer->doRender(Array, 1) (Line: 240)
Drupal\Core\Render\Renderer->render(Array, 1) (Line: 165)
Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() (Line: 627)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 166)
Drupal\Core\Render\Renderer->renderPlain(Array) (Line: 183)
Drupal\Core\Render\Renderer->doRenderPlaceholder(Array) (Line: 220)
Drupal\Core\Render\Renderer->renderPlaceholder('callback=Drupal%5Cviews_block_with_lazy_builder%5CPlugin%5CBlock%5CViewsBlockWithLazyBuilder%3A%3AviewsBlockWithLazyBuilderCallback&args%5Bsettings%5D=%7B%22id%22%3A%22views_bloc_with_lazy_builder_example%3Awpss_cp_products-recommended_products_block%22%2C%22label%22%3A%22%22%2C%22label_display%22%3A%22visible%22%2C%22provider%22%3A%22views_block_with_lazy_builder%22%2C%22views_label%22%3A%22%22%2C%22items_per_page%22%3A%22none%22%2C%22context_mapping%22%3A%5B%5D%7D&token=bV68bSVsi-ljbCZHUZbpM7exxEXMzAOoRowAvEGuiac', Array) (Line: 723)
Drupal\big_pipe\Render\BigPipe->renderPlaceholder('callback=Drupal%5Cviews_block_with_lazy_builder%5CPlugin%5CBlock%5CViewsBlockWithLazyBuilder%3A%3AviewsBlockWithLazyBuilderCallback&args%5Bsettings%5D=%7B%22id%22%3A%22views_bloc_with_lazy_builder_example%3Awpss_cp_products-recommended_products_block%22%2C%22label%22%3A%22%22%2C%22label_display%22%3A%22visible%22%2C%22provider%22%3A%22views_block_with_lazy_builder%22%2C%22views_label%22%3A%22%22%2C%22items_per_page%22%3A%22none%22%2C%22context_mapping%22%3A%5B%5D%7D&token=bV68bSVsi-ljbCZHUZbpM7exxEXMzAOoRowAvEGuiac', Array) (Line: 554)
Drupal\big_pipe\Render\BigPipe->Drupal\big_pipe\Render\{closure}()
Fiber->start() (Line: 566)
Drupal\big_pipe\Render\BigPipe->sendPlaceholders(Array, Array, Object) (Line: 305)
Drupal\big_pipe\Render\BigPipe->sendContent(Object) (Line: 112)
Drupal\big_pipe\Render\BigPipeResponse->sendContent() (Line: 423)
Symfony\Component\HttpFoundation\Response->send() (Line: 20)

Steps to reproduce

When the views block doesn't have any results and doesn't have "no results behaviour" then it leads to the assertion error.

Proposed resolution

The lazy builder callback should return a valid renderable array always. So I think there is no need to use part of the rendered views block. The whole renderable array can be returned instead of only "view_build" element.

πŸ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine nikita_tt

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

Merge Requests

Comments & Activities

Production build 0.69.0 2024