Problem/Motivation

The media library widget does not load when a paragraph contains a required entity reference field set to use the media library widget. Nothing happens when I click the "add media" button when editing the paragraph. If I remove the requirement from the entity reference field, the media library will load when the "add media" button is clicked. I tested a required entity reference field on a content type and encountered no errors so this seems to be related to paragraphs.

In my console, I'm seeing an ajax error with status code 500. Also, in my Drupal log I'm seeing:
"LogicException: Form errors cannot be set after form validation has finished. in Drupal\Core\Form\FormState->setErrorByName() (line 1057 of /app/docroot/core/lib/Drupal/Core/Form/FormState.php)."

I'm using the paragraphs experimental widget and Drupal version 8.7.0-beta2.

Comments

providence_matt created an issue. See original summary.

providence_matt’s picture

Issue summary: View changes
petr illek’s picture

I have the same issue and errors, but my conditions are little different. I have just a Media entity (not required) on a paragraph. When I click Add media button, nothing happenes and I got the above errors.
Media entity directly on node is working as expected.

Drupal 8.7.0, Paragraphs 8.x-1.8.

johnchque’s picture

Version: 8.x-1.8 » 8.x-1.x-dev

This looks like a duplicate of #3013171: LogicException Form errors cannot be set after form validation has finished.

Bug reports go always against the dev branch. :)

providence_matt’s picture

The patch in #3013171 worked! Closing this issue as a duplicate.

providence_matt’s picture

Status: Active » Closed (duplicate)