Answers.Body: <p>I think the problem is in your custom theme:</p>
  <p>wig_render_template('themes/custom/b4_piosite/templates/page.html.twig', Array) (Line: 384)</p>
  <p>It's doing something that this doesn't like:</p>
  <p>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 <a href="https://www.drupal.org/node/2966725" rel="nofollow noreferrer">https://www.drupal.org/node/2966725</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-17T09:06:50.027Z
Answers.Text: Thanks for your valuable input. I've switched back to core Bartik and still experience the error. I've updated the stacktrace in my original post.
Answers.UserDisplayName: cray146
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-15T16:49:51.307Z
Answers.LastActivityDate: 2021-03-15T16:49:51.307Z
Answers.UserDisplayName: Demerit
Body: <p>I'm running against a fatal error on an number of CiviCRM pages (stacktrace below). There seems to be a problem with a url that is passed to Drupal\Core\Url::fromUserInput() when building the CiviCRM breadcrumb.</p>
  <p>My setup:
  Drupal 9.1.5 (multilingual nl and fr)
  CiviCRM 5.35.0</p>
  <p>Any ideas?</p>
  <p>Thanks.</p>
  <p>UPDATE: I've updated the stacktrace in response of the answer of Demerit. I've switched to core Bartik theme instead of my custom theme and experience the same error.</p>
  <pre><code>Er is onverwacht een fout opgetreden. Probeer het later nog eens.
  
  InvalidArgumentException: The user-entered string 'https://nl.example.be.lndo.site/civicrm?reset=1' must begin with a '/', '?', or '#'. in Drupal\Core\Url::fromUserInput() (line 213 of core/lib/Drupal/Core/Url.php).
  
  Drupal\civicrm\CivicrmBreadcrumbBuilder-&gt;build(Object) (Line: 83)
  Drupal\Core\Breadcrumb\BreadcrumbManager-&gt;build(Object) (Line: 72)
  Drupal\system\Plugin\Block\SystemBreadcrumbBlock-&gt;build() (Line: 171)
  Drupal\block\BlockViewBuilder::preRender(Array)
  call_user_func_array(Array, Array) (Line: 101)
  Drupal\Core\Render\Renderer-&gt;doTrustedCallback(Array, 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: 781)
  Drupal\Core\Render\Renderer-&gt;doCallback('#pre_render', Array, Array) (Line: 372)
  Drupal\Core\Render\Renderer-&gt;doRender(Array) (Line: 444)
  Drupal\Core\Render\Renderer-&gt;doRender(Array, ) (Line: 200)
  Drupal\Core\Render\Renderer-&gt;render(Array) (Line: 450)
  Drupal\Core\Template\TwigExtension-&gt;escapeFilter(Object, Array, 'html', NULL, 1) (Line: 90)
  __TwigTemplate_7936d95d2109e2f3d9c3238b3a2874dfc12656eb43b3c81bb3249b679af13b6d-&gt;doDisplay(Array, Array) (Line: 405)
  Twig\Template-&gt;displayWithErrorHandling(Array, Array) (Line: 378)
  Twig\Template-&gt;display(Array) (Line: 390)
  Twig\Template-&gt;render(Array) (Line: 65)
  twig_render_template('core/themes/bartik/templates/page.html.twig', Array) (Line: 384)
  Drupal\Core\Theme\ThemeManager-&gt;render('page', Array) (Line: 431)
  Drupal\Core\Render\Renderer-&gt;doRender(Array, ) (Line: 200)
  Drupal\Core\Render\Renderer-&gt;render(Array) (Line: 450)
  Drupal\Core\Template\TwigExtension-&gt;escapeFilter(Object, Array, 'html', NULL, 1) (Line: 86)
  __TwigTemplate_7a63433aced4475eeba9239a5c5c71c161379c0b5254aa839ee30a407195e9cd-&gt;doDisplay(Array, Array) (Line: 405)
  Twig\Template-&gt;displayWithErrorHandling(Array, Array) (Line: 378)
  Twig\Template-&gt;display(Array) (Line: 390)
  Twig\Template-&gt;render(Array) (Line: 65)
  twig_render_template('core/themes/bartik/templates/classy/layout/html.html.twig', Array) (Line: 384)
  Drupal\Core\Theme\ThemeManager-&gt;render('html', Array) (Line: 431)
  Drupal\Core\Render\Renderer-&gt;doRender(Array, ) (Line: 200)
  Drupal\Core\Render\Renderer-&gt;render(Array) (Line: 162)
  Drupal\Core\Render\MainContent\HtmlRenderer-&gt;Drupal\Core\Render\MainContent\{closure}() (Line: 573)
  Drupal\Core\Render\Renderer-&gt;executeInRenderContext(Object, Object) (Line: 163)
  Drupal\Core\Render\MainContent\HtmlRenderer-&gt;renderResponse(Array, Object, Object) (Line: 90)
  Drupal\Core\EventSubscriber\MainContentViewSubscriber-&gt;onViewRenderArray(Object, 'kernel.view', Object)
  call_user_func(Array, Object, 'kernel.view', Object) (Line: 142)
  Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher-&gt;dispatch(Object, 'kernel.view') (Line: 163)
  Symfony\Component\HttpKernel\HttpKernel-&gt;handleRaw(Object, 1) (Line: 80)
  Symfony\Component\HttpKernel\HttpKernel-&gt;handle(Object, 1, 1) (Line: 57)
  Drupal\Core\StackMiddleware\Session-&gt;handle(Object, 1, 1) (Line: 47)
  Drupal\Core\StackMiddleware\KernelPreHandle-&gt;handle(Object, 1, 1) (Line: 106)
  Drupal\page_cache\StackMiddleware\PageCache-&gt;pass(Object, 1, 1) (Line: 85)
  Drupal\page_cache\StackMiddleware\PageCache-&gt;handle(Object, 1, 1) (Line: 47)
  Drupal\Core\StackMiddleware\ReverseProxyMiddleware-&gt;handle(Object, 1, 1) (Line: 52)
  Drupal\Core\StackMiddleware\NegotiationMiddleware-&gt;handle(Object, 1, 1) (Line: 23)
  Stack\StackedHttpKernel-&gt;handle(Object, 1, 1) (Line: 706)
  Drupal\Core\DrupalKernel-&gt;handle(Object) (Line: 19)
  
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-03-15T15:47:55.197Z
Comments.Text: This part is strange `Drupal\civicrm\CivicrmBreadcrumbBuilder->build(Object) (Line: 83)` because there is no line 83 in that file (src/CivicrmBreadcrumbBuilder.php). Do you have any customizations?
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-03-17T09:04:59.610Z
Comments.Text: This is strange indeed. I'm using a fresh CiviCRM install with no customizations. The build function is line 59 of src/CivicrmBreadcrumbBuilder.
Comments.UserDisplayName: cray146
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-03-17T16:14:25.913Z
Comments.Text: Ok, another clue then is `http://d9.example.be.lndo.site:/bin/civicrm?reset=1` is a very strange looking url. I'd double-check your settings in civicrm.settings.php and at civicrm/admin/setting/path and civicrm/admin/setting/url.
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-03-19T11:39:58.770Z
Comments.Text: True, the strange looking path went away by resetting paths. The problem continues though and drupal complains about a valid URL (see updated stacktrace).  Seems like drupal does not expect the CIVICRM_UF_BASEURL is part of the url that is passed to the function.
Comments.UserDisplayName: cray146
Tags: <error><drupal-9>
Title: Fatal error while building CiviCRM breadcrumb
ThreadText: # Fatal error while building CiviCRM breadcrumb
  
  (Asked by: username_0 on 2021-03-15)
  
  I'm running against a fatal error on an number of CiviCRM pages (stacktrace below). There seems to be a problem with a url that is passed to Drupal\Core\Url::fromUserInput() when building the CiviCRM breadcrumb.
  
  My setup:
  Drupal 9.1.5 (multilingual nl and fr)
  CiviCRM 5.35.0
  
  Any ideas?
  
  Thanks.
  
  UPDATE: I've updated the stacktrace in response of the answer of username_1. I've switched to core Bartik theme instead of my custom theme and experience the same error.
  
  ```
  Er is onverwacht een fout opgetreden. Probeer het later nog eens.
  
  InvalidArgumentException: The user-entered string 'https://nl.example.be.lndo.site/civicrm?reset=1' must begin with a '/', '?', or '#'. in Drupal\Core\Url::fromUserInput() (line 213 of core/lib/Drupal/Core/Url.php).
  
  Drupal\civicrm\CivicrmBreadcrumbBuilder->build(Object) (Line: 83)
  Drupal\Core\Breadcrumb\BreadcrumbManager->build(Object) (Line: 72)
  Drupal\system\Plugin\Block\SystemBreadcrumbBlock->build() (Line: 171)
  Drupal\block\BlockViewBuilder::preRender(Array)
  call_user_func_array(Array, Array) (Line: 101)
  Drupal\Core\Render\Renderer->doTrustedCallback(Array, 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: 781)
  Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 372)
  Drupal\Core\Render\Renderer->doRender(Array) (Line: 444)
  Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 200)
  Drupal\Core\Render\Renderer->render(Array) (Line: 450)
  Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 90)
  __TwigTemplate_7936d95d2109e2f3d9c3238b3a2874dfc12656eb43b3c81bb3249b679af13b6d->doDisplay(Array, Array) (Line: 405)
  Twig\Template->displayWithErrorHandling(Array, Array) (Line: 378)
  Twig\Template->display(Array) (Line: 390)
  Twig\Template->render(Array) (Line: 65)
  twig_render_template('core/themes/bartik/templates/page.html.twig', Array) (Line: 384)
  Drupal\Core\Theme\ThemeManager->render('page', Array) (Line: 431)
  Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 200)
  Drupal\Core\Render\Renderer->render(Array) (Line: 450)
  Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 86)
  __TwigTemplate_7a63433aced4475eeba9239a5c5c71c161379c0b5254aa839ee30a407195e9cd->doDisplay(Array, Array) (Line: 405)
  Twig\Template->displayWithErrorHandling(Array, Array) (Line: 378)
  Twig\Template->display(Array) (Line: 390)
  Twig\Template->render(Array) (Line: 65)
  twig_render_template('core/themes/bartik/templates/classy/layout/html.html.twig', Array) (Line: 384)
  Drupal\Core\Theme\ThemeManager->render('html', Array) (Line: 431)
  Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 200)
  Drupal\Core\Render\Renderer->render(Array) (Line: 162)
  Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 573)
  Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 163)
  Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
  Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
  call_user_func(Array, Object, 'kernel.view', Object) (Line: 142)
  Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 163)
  Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
  Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
  Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
  Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
  Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
  Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
  Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
  Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
  Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 706)
  Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
  
  ```
  
  **Tags:** error, drupal-9
  
  > **Comments:**
  > **username_1**: This part is strange `Drupal\civicrm\CivicrmBreadcrumbBuilder->build(Object) (Line: 83)` because there is no line 83 in that file (src/CivicrmBreadcrumbBuilder.php). Do you have any customizations?  
  > **username_0**: This is strange indeed. I'm using a fresh CiviCRM install with no customizations. The build function is line 59 of src/CivicrmBreadcrumbBuilder.  
  > **username_1**: Ok, another clue then is `http://d9.example.be.lndo.site:/bin/civicrm?reset=1` is a very strange looking url. I'd double-check your settings in civicrm.settings.php and at civicrm/admin/setting/path and civicrm/admin/setting/url.  
  > **username_0**: True, the strange looking path went away by resetting paths. The problem continues though and drupal complains about a valid URL (see updated stacktrace).  Seems like drupal does not expect the CIVICRM_UF_BASEURL is part of the url that is passed to the function.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-03-15. Score: 1
  
  I think the problem is in your custom theme:
  
  wig\_render\_template('themes/custom/b4\_piosite/templates/page.html.twig', Array) (Line: 384)
  
  It's doing something that this doesn't like:
  
  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>
  
  > **Comments:**
  > **username_0**: Thanks for your valuable input. I've switched back to core Bartik and still experience the error. I've updated the stacktrace in my original post.  
  
  ---
  
  