0

I'm using Layout Builder to manage the display of a content type.
I was playing around with the config and adding different things, and something I added caused the page to crash and now I get this error:

The website encountered an unexpected error. Please try again later.Drupal\Core\Entity\EntityMalformedException: The "node" entity cannot have a URI as it does not have an ID in Drupal\Core\Entity\EntityBase->toUrl() (line 191 of core/lib/Drupal/Core/Entity/EntityBase.php). node_tokens('node', Array, Array, Array, Object)

This error persists every time I click "Manage Display" for that content type; I rebuilt the cache with Drush and cleared my browser cache, but I still get the error when I go to edit the display settings. I get the error when I log in with a different browser, too, and also when I revert the config.

I am working on this site locally, so I can pull from the dev server, but is there another way to reset my "unsaved changes" locally so that I don't have to wait for the pull to complete?

2
  • Can you get a full error message with backtrace to see which code is trying to get a URI from a node without ID?
    – 4uk4
    Commented Oct 30, 2019 at 14:26
  • It's DB related, you don't need to pull the code base, just import the dev db again assuming you haven't made any config changes that you want to push.
    – No Sssweat
    Commented Oct 31, 2019 at 0:28

1 Answer 1

1

Layout builder stores in-progress modifications to the layout config in the key_value_expire table. Whenever Layout Builder is loaded (e.g. Manage Display, Page Manager, etc.), it first checks that table if there is an in-progress entry for the layout you're about to edit. If it exists, it tries to load that, otherwise it loads the one saved in config.

The problem is, that in-progress config may contain bad data (e.g. a block that was added but has bad implementation) or outdated data (e.g. a block that you were working on, but whose implementation has already been deleted). This can cause Layout Builder to fail loading. As far as I know, Drupal has no way of guarding or recovering from this from the admin side nor does a cache rebuild help.

One way to recover is to load a copy of the DB prior to your changes, but that may take forever and blow away any other work in progress you have. Another is to dive into the key_value_expire table and look for that in-progress entry, delete it, and reload Layout Builder.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.