Uncaught RuntimeException in Drupal\workspaces\EntityOperations

Created on 2 December 2019, about 5 years ago
Updated 8 March 2024, 11 months ago

Problem/Motivation

I'm getting uncaught RuntimeException when trying to navigate to the edit manage content type display page when I'm in staging workspace. It seems to happen only with recipes content type.

Steps to reproduce:

  • Install Drupal with Umami demo profile
  • Enable Workspaces module
  • Switch to staging environment
  • Navigate to /admin/structure/types/manage/recipe/display

This should result in the following exception:

RuntimeException: This entity can only be saved in the default workspace. in Drupal\workspaces\EntityOperations->entityPresave() (line 124 of core/modules/workspaces/src/EntityOperations.php).
workspaces_entity_presave(Object, 'entity_view_display')
call_user_func_array('workspaces_entity_presave', Array) (Line: 403)
Drupal\Core\Extension\ModuleHandler->invokeAll('entity_presave', Array) (Line: 349)
Drupal\Core\Config\Entity\ConfigEntityStorage->invokeHook('presave', Object) (Line: 500)

This has some usability considerations because of the default and recommended setting for production environments is to have error messages not visible, meaning that some users might only see a generic error message: The website encountered an unexpected error. Please try again later..

Proposed resolution

It seems like we need error handler that displays message to all users regardless of the error messages to display setting.

OR, as suggested in #3

Address the underlying problem: why does navigating to a page (/admin/structure/types/manage/recipe/display) executes the presave hook for the entity_view_display entity type?

Remaining tasks

Decide on a solution
Patch
Review

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Closed: outdated

Version

11.0 🔥

Component
Workspaces 

Last updated about 18 hours ago

No maintainer
Created by

🇫🇮Finland lauriii Finland

Live updates comments and jobs are added and updated live.
  • Usability

    Makes Drupal easier to use. Preferred over UX, D7UX, etc.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇷🇴Romania amateescu

    Just tested this on 10.3.x and it's not reproducible anymore. I'm guessing that the problem was caused by Layout Builder, and it was fixed in the meantime.

Production build 0.71.5 2024