I am using Media Module 7.x-2.0-unstable 6 & File Entity 7.x-2.0-unstable6
The Log Messages shows me following error:
Unable to render media from {"type":"media","view_mode":"media_original","fid":"26","attributes":{"alt":"","class":"media-image","height":"330","width":"260"}}. Error: Could not load media object
Only one node causes this problem. I think a used the Media Module with the WYSIWYG Editor and removed the file because I dont need it anymore. The node now contains no media files. It´s pure text.
How can I get rid of the problem? It´s a very important node and my Log Messages are full of that.
thanks in advance!
Comments
Comment #1
Kristen PolI'm seeing this as well with those unstable6 versions.
Comment #2
Dave ReidThis typically means that the file entity no longer exists (was deleted). You should edit the raw version of the text field (turn off or disable the WYSIWYG temporarily), and remove the media tags that reference that FID.
Comment #3
Goekmen CreditAttribution: Goekmen commentedI have deleted all fields (everything is empty) and turn off the editor but I still have the error in the logs.
Comment #4
Goekmen CreditAttribution: Goekmen commentedI have some referenced nodes to this special node.
Every node connected to this node output this error messages.
Can I upload a new image and edit the fid manually in the MySQL Database?
Comment #5
dddave CreditAttribution: dddave commented#1676780: Uploaded media file disappears after node save marked as dupe although it seems to be a bigger issue for him.
Setting to dev as I am too seeing this from time to time.
Comment #6
dasfuller CreditAttribution: dasfuller commentedAny movement on this issue? We just experienced it with Media 7.x-2.0-alpha2 and File Entity 7.x-2.0-alpha3.
Unable to render media from {"fid":"21080","view_mode":"default","fields":{"format":"default"},"type":"media","attributes":{}}. Error: Could not load media object
This happened for all three media elements embedded in the single node's description.
Comment #7
MediaFormat CreditAttribution: MediaFormat commentedMedia 7.x-2.0-alpha4
File Entity 7.x-2.0-beta1.
This was happening even though the file entity was not deleted.
It seems that media has trouble escaping characters in the
alt
field.The following contains single and double quotes. Though not visible here, the first double-quote was triple escaped and the last quote unescaped.
Edited for clarity.
Comment #8
nickBumgarner CreditAttribution: nickBumgarner commentedI'm running into this problem anytime I add a link to my media image via WYSIWYG's Media Uploader interface. It won't display the image and I'm getting the same issue.
Comment #9
charnibp CreditAttribution: charnibp commentedI'm having a very similar issue and getting the same error in my logs.
My modules:
Media 7.x-2.0-alpha4
File Entity 7.x-2.0-beta1
Steps to reproduce:
The only way I can stop this error from happening is removing the media reference from the body text of the node (manually in the database), and clearing the drupal cache. Clearing the cache is a very important step to get it working again! Unfortunately, this means I am unable to embed media items in my content without a fix!
Comment #10
martinwrightinfo CreditAttribution: martinwrightinfo commentedI'm also having this issue. The image appears when I'm editing then when I click save, it disappears.
I've have to switch to a plain text editor and remove the alt and title info from the media embed code.
But is I edit the node again alt and title get automatic put back in. then the image disappears again.
Comment #11
PraetorianFX CreditAttribution: PraetorianFX commented#7 was happening to me... yes bug with esc character for alt text, title text..
especialy for double quote char..
thx in advance..
Comment #12
PraetorianFX CreditAttribution: PraetorianFX commentedComment #13
PraetorianFX CreditAttribution: PraetorianFX commented#7 was happening to me... yes bug with esc character for alt text, title text..
especialy for double quote char..
thx in advance..
Comment #14
michaelmallett CreditAttribution: michaelmallett commentedWe also get this almost randomly ever since updating media to 7.x-2.0-alpha4. Clearing the cache returns it to normal, but bizarrely I can't seem to find any media errors for those pages in the logs.
However, in our case, instead of just disappearing, it outputs the media object itself to the page. It's really strange as the issue just appears again a seemingly random time later.
Comment #15
PatchRanger CreditAttribution: PatchRanger as a volunteer commentedAccording to https://www.drupal.org/node/2378315#comment-9707471 , it looks like the issue is related to "Convert Media tags to markup" feature. Disabling it at
admin/config/content/formats/full_html
looks to eliminate the annoying log message appearing. So I guess we need to look deep into the converting Media tags code - the root of the issue is definitely there.Comment #16
Rob_Feature CreditAttribution: Rob_Feature commentedI'm still seeing this in the latest dev of both media and file entity. The majority of our wysiwyg embedded media disappears when viewing the node (due to a bug somewhere in the input filter, I guess)
Comment #17
Rob_Feature CreditAttribution: Rob_Feature commentedFolks may disagree, but I'm going to mark this as 'major' since it is completely preventing images we're putting into the wysiwyg from appearing (ie. the filter just doesn't work as it should). In our case, there's a 'caption' field on the file entity. If this field has any html in it, it breaks the display as mentioned in this issue.
Comment #18
jpoesen CreditAttribution: jpoesen commentedJust seconding #17 here: we have a caption field on file entities too.
As soon as someone adds a simple html link in the caption field, which is often done to refer back to copyright holders, it breaks.
Comment #19
michaelmallett CreditAttribution: michaelmallett commentedSorry for the late follow up to mine, we solved this because it seemed the update had disabled the convert media tags checkbox. We were also behind a couple of caching layers so when that was being enabled again, one of the layers wasn't clearing and we ended up with a cached json object on the page. Fully clearing the caching solved the issue with the checkbox enabled for us.
Comment #20
Rob_Feature CreditAttribution: Rob_Feature commentedFor the record (at least in my case): I found that if you leave 'www' out of any links you put into the caption field, then the image appears and links work correctly. Yeah..wacky. But it works for us!
Comment #21
brockfanning CreditAttribution: brockfanning commented@Rob_Feature: I don't know if you're using Ckeditor, but this issue might be relevant for your problem: #2720997: Overridden fields not encoded in token
Comment #22
Rob_Feature CreditAttribution: Rob_Feature commented@brockfanning I'm not using the media_ckeditor module (which that issue references). Using WSYIWYG module with CKEditor library, which I don't think would have this same problem.
Comment #23
Rob_Feature CreditAttribution: Rob_Feature commentedI realized this problem is due to media_wysiwyg_token_to_markup() being passed links in non-html-safe json format. If you look at that function you'll see
$tag_info = drupal_json_decode($tag);
. At this point, if $tag contains a field with a link in a json-hostile format, this decode will fail and $tag_info will be empty.This means the problem doesn't lie, technically, in media_wysiwyg_token_to_markup()...it's a problem earlier with html not being parsed correctly before it's sent to the function.
When trying to troubleshoot this, I ran into this issue: #2831810: media wysiwyg tokens with html are corrupted on save with the latest dev. Now (I think) it's trying to encode links, but it's not doing it correctly.
Comment #24
Rob_Feature CreditAttribution: Rob_Feature commentedJust a note that the fix in #2831810: media wysiwyg tokens with html are corrupted on save doesn't solve this. Links are still being passed to drupal_json_decode() in a unfriendly format.
Comment #25
Rob_Feature CreditAttribution: Rob_Feature commentedI've spent quite a bit of time working on this issue and I've come to some conclusions. What I've learned leads me to change the status of this from a bug to a support request (and set it's priority to 'normal'). I'm also going to close this issue (mark it 'works as designed') because I don't think there's anything to be done by the module maintainers. Here's why:
First, it's important to realize that the error message "unable to render media..." is actually a really generic error. It doesn't point to a specific problem, but instead it essentially says "something is wrong with a particular piece of media/file...we can't load it for some (unspecified) reason". This could be caused by a huge number of factors, but in the end the message is a generic "something failed when loading a particular file".
If this were a bug, you'd have this message reported for EVERY piece of media on your site (that's a bit of an exaggeration, but you get the idea). Since this error is most often referring to one (or a handful) or specific files that can't be loaded, that tells you the problem is with that specific file (or something in that specific node)...it's not something module-wide.
I realized, in my case, that some site-specific code was feeding bad media tokens to the media module. But in other cases (as Dave says early in this issue) it may be because the file doesn't exist, or any number of other reasons.
That all leads me to believe this error (as reported) is actually site specific (something unique to your particular installation/file system) but not always caused by the same problem. It's a generic error with lots of causes on a case by case basis.
Comment #26
mducharme CreditAttribution: mducharme as a volunteer commentedRelated (for some)? https://www.drupal.org/node/2838674
Comment #27
ron_s CreditAttribution: ron_s commentedMight also want to check out this patch: https://www.drupal.org/project/media/issues/2989181
media_wysiwyg will generate this error if your content already contains a double-bracketed token.
Comment #28
SohelPathan CreditAttribution: SohelPathan commentedHello All,
It is late response but I thought It may help someone in the future.
I was facing the same issue and I could resolve it with the following steps:
Go to :
Configuration >> Content Authoring >> Text Formats >> Filtered HTML >> Click on configure >> Go to "Filter Settings" tab at bottom part >> Select "Limit allowed HTML tags" tab >> Add "
<img>
" and other tags that you are going to use in Text Editor. When you use Image control, system picks-up "img" HTML tag for it. Save the configuration and check your content after refreshing it.(I am using "Filtered HTML" mode in text editor, you may have many more, then do the same thing for all types).
Last line, I am using Drupal 7.82. There may be a similar kind of configuration option in D8 as well.
Thanks