Crash on multilingual site where not all languages of one book are published

Created on 22 May 2025, 16 days ago

The following steps to reproduce is using the core version of book but I think it affects the 2.0.x branch as well:

1. Go to simplytest.me and spin up a sandbox site running Drupal core 10.4.7.
2. Log in using the default username admin and password admin.
3. Enable the Book, Language, and Content Translation modules using the Extend menu.
4. Go to Configuration -> Languages and add a second language (e.g. French).
5. Go to /admin/structure/types/manage/article and enable translation under the Language settings tab.
6. Create a new Article node. Fill in some random test content, and make sure the Published checkbox is unchecked.
7. Go the the Outline tab and select Create a new book.
8. Add a French translation to the newly created node. Fill in some random test content, and make sure the Published checkbox is checked.
9. Now view the newly created French node in a logged out state / incognito window.
10. You get a WSOD:

The website encountered an unexpected error. Try again later.

TypeError: Drupal\book\ProxyClass\BookManager::bookTreeOutput(): Argument #1 ($tree) must be of type array, null given, called in /var/lib/tugboat/stm/web/core/modules/book/src/Plugin/Block/BookNavigationBlock.php on line 175 in Drupal\book\ProxyClass\BookManager->bookTreeOutput() (line 163 of core/modules/book/src/ProxyClass/BookManager.php).
Drupal\book\Plugin\Block\BookNavigationBlock->build() (Line: 171)
Drupal\block\BlockViewBuilder::preRender(Array)
call_user_func_array('Drupal\block\BlockViewBuilder::preRender', Array) (Line: 113)
Drupal\Core\Render\Renderer->doTrustedCallback('Drupal\block\BlockViewBuilder::preRender', Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 875)
Drupal\Core\Render\Renderer->doCallback('#pre_render', 'Drupal\block\BlockViewBuilder::preRender', Array) (Line: 432)
Drupal\Core\Render\Renderer->doRender(Array, 1) (Line: 248)
Drupal\Core\Render\Renderer->render(Array, 1) (Line: 165)
Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 164)
Drupal\Core\Render\Renderer->renderInIsolation(Array) (Line: 191)
Drupal\Core\Render\Renderer->doRenderPlaceholder(Array) (Line: 728)
Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}()
Fiber->start() (Line: 736)
Drupal\Core\Render\Renderer->replacePlaceholders(Array) (Line: 608)
Drupal\Core\Render\Renderer->doRender(Array, 1) (Line: 248)
Drupal\Core\Render\Renderer->render(Array, 1) (Line: 153)
Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 152)
Drupal\Core\Render\Renderer->renderRoot(Array) (Line: 288)
Drupal\Core\Render\HtmlResponseAttachmentsProcessor->renderPlaceholders(Object) (Line: 74)
Drupal\big_pipe\Render\BigPipeResponseAttachmentsProcessor->processAttachments(Object) (Line: 45)
Drupal\Core\EventSubscriber\HtmlResponseSubscriber->onRespond(Object, 'kernel.response', Object)
call_user_func(Array, Object, 'kernel.response', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.response') (Line: 214)
Symfony\Component\HttpKernel\HttpKernel->filterResponse(Object, Object, 1) (Line: 202)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 201)
Drupal\page_cache\StackMiddleware\PageCache->fetch(Object, 1, 1) (Line: 138)
Drupal\page_cache\StackMiddleware\PageCache->lookup(Object, 1, 1) (Line: 87)
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: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 741)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇨🇦Canada andrew.wang

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

Comments & Activities

Production build 0.71.5 2024