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!


Kristen Pol’s picture

I'm seeing this as well with those unstable6 versions.

Dave Reid’s picture

Category: bug » support

This 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.

Goekmen’s picture

I have deleted all fields (everything is empty) and turn off the editor but I still have the error in the logs.

Goekmen’s picture

I 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?

dddave’s picture

Version: 7.x-2.0-unstable6 » 7.x-2.x-dev

#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.

dasfuller’s picture

Issue summary: View changes

Any 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.

MediaFormat’s picture

Category: Support request » Bug report

Media 7.x-2.0-alpha4
File Entity 7.x-2.0-beta1.

This 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.

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.

Unable to render media from {"fid":"107","view_mode":"default","fields":{"format":"default","field_file_image_alt_text[und][0][value]":"","field_file_image_title_text[und][0][value]":"","field_tags[und]":""},"type":"media","attributes":{"alt":"Est-ce qu'il m'apporte différents points de vue sur la question? Des solutions dans la section \\\"Objectvité de l'information"","height":300,"width":700,"class":"media-element file-default"},"link_text":null}. Error: No file Id

Edited for clarity.

nickBumgarner’s picture

I'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.

charnibp’s picture

I'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:

  1. In basic content page, embed media within the RTE (in this example, my media is a Youtube video, using Media:Youtube)
  2. Save
  3. Visit content page
  4. Page doesn't load, error in Drupal log:

    Unable to render media from {"fid":"1254","view_mode":"default","type":"media","attributes":{"class":"media-youtube-video media-youtube-1 media-element file-default"}}. Error: Could not lo

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!

martinwrightinfo’s picture

I'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.

PraetorianFX’s picture

Issue summary: View changes

#7 was happening to me... yes bug with esc character for alt text, title text..

especialy for double quote char..

thx in advance..

PraetorianFX’s picture

Issue summary: View changes
PraetorianFX’s picture

#7 was happening to me... yes bug with esc character for alt text, title text..

especialy for double quote char..

thx in advance..

michaelmallett’s picture

We 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.

PatchRanger’s picture

According 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.

Rob_Feature’s picture

I'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)

Rob_Feature’s picture

Component: Code » Media WYSIWYG
Priority: Normal » Major

Folks 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.

jpoesen’s picture

Just 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.

michaelmallett’s picture

Sorry 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.

Rob_Feature’s picture

For 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!

brockfanning’s picture

@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

Rob_Feature’s picture

@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.

Rob_Feature’s picture

I 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.

Rob_Feature’s picture

Just 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.

Rob_Feature’s picture

Title: Unable to render media from » Unable to render media from... (error message)
Category: Bug report » Support request
Priority: Major » Normal
Status: Active » Closed (works as designed)

I'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.

mducharme’s picture