Hello, after upgrade do 8.x-4.0 I have seen this error messages:
Drupal\entity_embed\Exception\EntityNotFoundException: Unable to load embedded file entity b06258c6-5b16-4403-a363-82a52e51dcaa. in Drupal\entity_embed\Plugin\Filter\EntityEmbedFilter->process() (line 161 of /home/dbacecde/xxxxx.tld/modules/entity_embed/src/Plugin/Filter/EntityEmbedFilter.php).

etc...

Comments

mpark created an issue. See original summary.

Ralf Eisler’s picture

Got the same error message here:
Drupal\entity_embed\Exception\EntityNotFoundException: Unable to load embedded media entity 3aaa056f-dd95-418c-94c2-a34f990fc2cb. in Drupal\entity_embed\Plugin\Filter\EntityEmbedFilter->process() (line 161 of /home/mywebsite.com/docroot/modules/contrib/entity_embed/src/Plugin/Filter/EntityEmbedFilter.php).

mpark’s picture

Priority: Normal » Major
mpark’s picture

Hi guys, any solution? What about 8.4. core, can I use this module still or jump to core media?

stockticker’s picture

I was trying to reproduce this, however things work fine on my 8.4 site.
However, I did a clean install, so it could be, that bug appear after upgrade to 8.4

mpark’s picture

Hi. You are right, could be after upgrade only, but what we can do it in the running websites?
Mark

stockticker’s picture

I would try to debug, to find out why it's actually get no $entity on line 119 in EntityEmbedFilter.php - for me it would be starting point.

bronk’s picture

Getting this as well. Coming from a route not working though and then a 404 where it's trying to load a missing file. I would definitely start on line 95 of EntityEmbedFilter to find out where it's coming from.

heymo’s picture

Same issue here. Given that this is a 4 months old topic, has anybody found the cause of this yet?

ktch_my’s picture

Get this as well, after upgrade Drupal core from 8.4 to 8.5.

gngn’s picture

I'm getting this too.

Might be a user embedded an existing enity which was later deleted - but is still referenced via entity_embed.

In my case the error is triggered by search cron indexing nodes (which can have embedded entities) - so I do not know which drupal node is responsible.
Is there any possibility to get the embedding entity in EntityEmbedFilter::process() to debug further?

wim leers’s picture

Title: Unable to load embedded file entity » EntityNotFoundException in EntityEmbedFilter ("Unable to load embedded file entity")
Category: Bug report » Support request
Priority: Major » Normal
Status: Active » Postponed (maintainer needs more info)
Issue tags: +Needs steps to reproduce

Might be a user embedded an existing enity which was later deleted

This sounds highly likely. It'd be great if somebody could confirm this.

gngn’s picture

If somebody could point me to any possibility to get the embedding entity in EntityEmbedFilter::process() I could debug further
(and maybe confirm the thought from #11).

wim leers’s picture

@gngn: you can't really "get" it in that context, since a filter plugin only receives the text to filter, not the entity whose text it is (since an entity is not required to use the filter system). So if you want the embedding entity, then it's best to just put a breakpoint in place, and manually load the embedding entity, and go from there.

wim leers’s picture

gngn’s picture

I managed to fix my problem "manually".
In my case it was indeed a (later on deleted) media inserted in a WYSIWYG field via entity_embed.

In case anyone is interested, that's what I did:

  • First I dumped my database with drush sql-dump --ordered-dump > dump.sql
    This results in one-line-per-insert statements
  • I searched in the dump for the uuid: grep 'ec06e3d8-1995-48e6-9173-4b40bca7e2ca' dump.sql
  • which gave me several lines like
    INSERT INTO `paragraph__field_text` VALUES ('pt_text',0,34260,34276,'en',0,'[...] <drupal-entity data-embed-button=\"embed_document\" data-entity-embed-display=\"view_mode:media.download\" data-entity-type=\"media\" data-entity-uuid=\"ec06e3d8-1995-48e6-9173-4b40bca7e2ca\"></drupal-entity>[...]'
    so it was a paragraph field.
  • From there I dug in the database to get the entity embedding the paragraph and edited it in the UI
  • But there I cannot see the deleted entity and therefor cannot delete it - see 2982322
  • So I had to change to "Full HTML" and "view source" to edit the plain text, remove the <drupal-entity...</drupal-entity>, change back to my restricted filter format and save
  • That's it ;)

thank you - and I'm hoping for a way to see a missing media in the editor (2982322...

wim leers’s picture

Status: Postponed (maintainer needs more info) » Fixed
Issue tags: -Needs steps to reproduce +Media Initiative

In my case it was indeed a (later on deleted) media inserted in a WYSIWYG field via entity_embed.

Thanks for confirming! Thank you very much for taking the time to not only investigate how to prove this, but then also document the steps! This is super super super valuable. THANK YOU! 👏

The ideal solution here would be to have usage tracking and then forbid deleting a Media entity if it has any usages. But there's a super complex cluster of critical Drupal core issues wrt usage tracking. So we shouldn't block ourselves on that. So yes, this just further confirms the need for #2982322: Mark missing embedded entities in WYSIWYG!

I'm marking this issue fixed and using #16 + the analysis in this comment to elevate the priority of #2982322: Mark missing embedded entities in WYSIWYG. I'll also make sure you are credited on that issue for your research!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

kuldeepbarot’s picture

kuldeepbarot’s picture

Re-rolled patch #19 for 8.x-1.7