Ajax Error: Call to a member function label() on null when removing media item

Created on 26 August 2021, almost 3 years ago
Updated 3 April 2023, about 1 year ago

When trying to remove a media item from the node, It doesn't do anything but I do get an ajax console error:

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /node/30/edit?ajax_form=1
StatusText: OK
ResponseText: Error: Call to a member function label() on null in Drupal\media_library\Plugin\Field\FieldWidget\MediaLibraryWidget::updateWidget() (line 686 of /core/modules/media_library/src/Plugin/Field/FieldWidget/MediaLibraryWidget.php)."

🐛 Bug report
Status

Needs work

Version

9.5

Component
Media 

Last updated about 4 hours ago

Created by

🇺🇸United States jcontreras

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

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.

  • 🇹🇷Turkey makbay

    Same here. Actually $field_state['removed_item_id'] does not exist.

  • Status changed to Needs review about 1 year ago
  • 🇮🇳India Ranjit1032002

    Created a patch for the issue mentioned, please review.
    Thank You.

  • Status changed to Needs work about 1 year ago
  • 🇺🇸United States smustgrave

    Could use specific steps for reproducing this. Was not able to on a fresh Drupal install.

    Issue summary should be updated with proposed solution.

    Current patch looks like it could be covering up a deeper problem.

    Once that information is gathered and we agree on the approach tests will be needed.

Production build 0.69.0 2024