Overview
Previously reported by … multiple people, but most recently by Gábor Hojtsy.
- Install Standard install profile
- Install
experience_builder
- Create article node — let's assume it's node
1
- Install
xb_dev_standard
- Go to
/node/1 and you'll get not the rendered article but … a fatal error:
The website encountered an unexpected error. Try again later.
AssertionError: assert($items->count() === 1) in assert() (line 30 of modules/contrib/experience_builder/src/Plugin/Field/FieldFormatter/NaiveComponentTreeFormatter.php).
Drupal\experience_builder\Plugin\Field\FieldFormatter\NaiveComponentTreeFormatter->viewElements(Object, 'en') (Line: 91)
Drupal\Core\Field\FormatterBase->view(Object, 'en') (Line: 275)
Drupal\Core\Entity\Entity\EntityViewDisplay->buildMultiple(Array) (Line: 340)
Drupal\Core\Entity\EntityViewBuilder->buildComponents(Array, Array, Array, 'full') (Line: 24)
Drupal\node\NodeViewBuilder->buildComponents(Array, Array, Array, 'full') (Line: 282)
Drupal\Core\Entity\EntityViewBuilder->buildMultiple(Array) (Line: 239)
…
Drupal\Core\DrupalKernel->handle(Object) (Line: 21)
- Try to edit this article in XB, by navigating to
/xb/node/1/editor, which will not lead to a working XB UI, but to:
Both of these make trying XB, or gradually adopting it a very unfriendly (and even frightening) experience on existing content.
Proposed resolution
The crash in point 5 is caused by \Drupal\experience_builder\Plugin\Field\FieldFormatter\NaiveComponentTreeFormatter::viewElements() requiring a non-empty XB field.
The crash in point 6 is caused by \Drupal\experience_builder\Controller\ApiLayoutController::get() having a similar assumption.
User interface changes
No more crashes.
Comments
Comment #4
wim leersComment #5
wim leersComment #8
wim leersMarked #3503467: Error: AssertionError: assert($items->count() === 1) in assert() as a duplicate. This is very low-hanging fruit.
Comment #9
wim leersAny takers? 😇
Comment #10
isholgueras commentedI still have some time 🤜🤛
Comment #11
isholgueras commentedIs this still an issue? I've went through:
1. Install Standard install profile


2. Install experience_builder
3. Create article node — let's assume it's node 1
4. Install xb_dev_standard
5. Go to /node/1 and ...
... add a new image (without the media module)
6. Click "Review 1 change" and "Publish"
7. Visit /node/1 and see my image
I can investigate deeper on when this was fixed, but I think this can be closed.
Comment #12
wim leersOh, that would be _delightful_ news! :D
Comment #13
lauriiiComment #14
mayur-sose commentedI have followed the steps below to try and reproduce the issue, but issue is not getting reproduced :
Steps followed:
xb_dev_standard./node/1to check if the article rendered or if a fatal error appeared./xb/node/1/editorto see if it resulted in a broken XB UI.While testing, I did not encounter any errors or broken UI. So this issue can be closed.
Comment #15
wim leersThat's wonderful news! 🥳