Needs work
Project:
Drupal core
Version:
main
Component:
media system
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
14 Sep 2019 at 16:54 UTC
Updated:
12 Jan 2026 at 13:39 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
jfortune commentedI have found that in MediaLibrarySelectForm::updateWidget method that $field_id was giving back zero $selcted_ids. I made a patch that will check the "media_library_select_form" and if it exist then add them to $selected_ids.
Comment #3
cilefen commentedComment #4
cilefen commentedComment #6
dmitry.korhovApplied patch for latest 8.8.1 release
Comment #7
dmitry.korhovComment #8
dmitry.korhovComment #10
phenaproximaIs there any chance of us getting some steps to reproduce this bug, ideally on a clean installation of Drupal?
Comment #11
phenaproximaI think that this will, at a minimum, need automated test coverage. Marking as "needs work" for that.
Comment #12
colepacak commented@JFortune, your patch from #2 worked great for Drupal 8.9.9. I really appreciate it.
Comment #13
joncjordan commentedI added some related issues:
https://www.drupal.org/project/drupal/issues/3080800
https://www.drupal.org/project/drupal/issues/3211232
Comment #16
joshua1234511Tried to replicate the issue, Tested on v 9.4.0
- Steps Followed
-- Enabled layout builder.
-- Edit the block type and added a field with media embed widget.
-- Adding new image or selecting of image and insert works as intended.
Issue detected when No image is selected and insert image is clicked, It does not display the error on the form, but logs it ind blogs.
Comment #17
kristen polThanks for testing. Needs work to fix the issue noted.
Comment #19
awset commentedhi all,
in regards @joshua1234511 comment #16
I think https://www.drupal.org/project/drupal/issues/3167799 will solve this issue.
the solution in that issue is to disable the button if no media is selected.
have a look at the comment #49
it has a video demonstrated the disabled button when no item selected.
but unfortunately, the original issue posted here is still mystery for me,
the OP said "The error occurs when trying to insert the selected image submit button is pressed."
this means OP did select an image but it silently fail?
if possible can we get the step to replicate it in D9.5?
thanks.
Comment #20
joshua1234511Thank you @awset for providing the related issue.
The original issue has been fixed and tested in patch #6
The issue I reported is related to Media library widget counter does not reset when removing and re-adding media
Comment #23
adriancotter commentedI am getting this error, Inserting an Image into an media field --within a nested paragraph (a paragraph within a paragraph) -- choosing from the media library. The error only occurs when the view has been filtered. If the user just chooses an image from the first screen, the error does not occur.
It works fine (choosing a filtered image) when the media field is on the page, and when the media field is in an unnested paragraph.
The error displayed to the user is (if they close the media library and scroll to the top -- otherwise it just looks like nothing happens)
"Oops, something went wrong. Check your browser's developer console for more details."
In the console I see:
Drupal.AjaxError {message: '\nAn AJAX HTTP error occurred
Digging into the AJAX code there is a parser error, though I've not been able to figure out what the actual error problem is with parsing.
The context url is media_library_opener_id=media_library.opener.field_widget&media_library_allowed_types%5Bimage%5D=image&media_library_selected_type=image&media_library_remaining=1&media_library_opener_parameters%5Bfield_widget_id%5D=field_media%3A-field_paragraphs-0-subform-field_card-0-subform&media_library_opener_parameters%5Bentity_type_id%5D=paragraph&media_library_opener_parameters%5Bbundle%5D=somebundle&media_library_opener_parameters%5Bfield_name%5D=field_media&media_library_opener_parameters%5Bentity_id%5D=271207&media_library_opener_parameters%5Brevision_id%5D=472632&hash=...&name=vol&label=Some%20Label&sort_by=created&ajax_form=1&views_display_id=widget&_wrapper_format=drupal_ajax
Comment #26
mayurgajar commentedAdded PR: https://git.drupalcode.org/project/drupal/-/merge_requests/14305
Steps to replicate issue:
1. On layout builder
2. Edit any content like block
3. In that for media -> select media image and image not selected
4. this will add error in logs