I just upgraded to Drupal 7.8 and began encountering this (fatal) error:

EntityMalformedException: Missing bundle property on entity of type file. in entity_extract_ids() (line 7389 of /

Disabling the File Entity module caused it to go away. (Uninstalling and re-enabling caused the error to come back.)

(I just realized the File Entity module is it's own project, though it appears in the Media group under Modules. I am using the latest -dev version of file_entity.)

#47 fix-missing-bundle.patch495 bytestafkey
PASSED: [[SimpleTest]]: [MySQL] 62 pass(es). View
Members fund testing for the Drupal project. Drupal Association Learn more


Tom P’s picture


zigmoo’s picture

me too!

nemo_Anhoa’s picture

subscribe, I encounter this also after upgrade to 7.8

Desi Raaj’s picture

same issue here

leeresglas’s picture

I have the same issue which is obviously caused by a missing entity-type-property in an entity-object. I took a look into my database and discovered that the table "file_managed" has a field "type". I filled in the type of the entity object in question and it works.
Obviously this is not a real solution (updating the database manually), because there exist hundreds of entries...

willmoy’s picture

leeresglas is right, if you fill in type it fixes the problem (which killed admin/content for me).

I'm not sure if the correct solution is to make file_entity tolerant of a null type or ensure the type always gets filled in. Perhaps both.

wojtek.krawczyk’s picture

Version: 7.x-1.0-beta5 » 7.x-1.x-dev


Starminder’s picture


somatics’s picture

We are having the same problem, on upgrade from 7.7 to 7.8 today, but we do NOT have the Media modules installed.

It's preventing us from rebuilding our permissions, which we urgently need to do. When I run Rebuild Permissions, it fails with the following error:

"An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /batch?id=39158&op=do StatusText: Service unavailable (with message) ResponseText: EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7389 of /pathtodrupalfolder/includes/common.inc)."

effulgentsia’s picture

Priority: Normal » Critical

Re #9, see #1268006-11: Get error when upgrading from 7.7 to 7.8 EntityMalformedException:Missing bundle property on entity of type file. in entity_extr about your case being different.

For the others, this is a critical regression caused by a change that went into Drupal 7.8. As a stop-gap measure, you can apply the patch in #1067750-49: Let Field API fail in a tale-telling way on invalid $entity to reverse the key part of that change. If that patch doesn't get committed to Drupal core, then Media module will need to be fixed accordingly to work with that change.

For those using the File Entity module that's its own project, rather than the one bundled with Media 1.x, see also #1268378: Empty file type causes exceptions in Drupal 7.8.

2ifx.com’s picture

Thanks, that patch found here: #1067750-49: Let Field API fail in a tale-telling way on invalid $entity worked for me!!

nitmd’s picture

I went to enter the type for my various entries, but am not sure what to put in there. Many of the empties are pdf files, and I found some reference to that elsewhere but it was confusing. Don't want to make a bad problem worse. Is there a list of "types" for the database?

texis’s picture


carusen’s picture

subscribe. I just migrated from 7.7 to 7.8

I do not have any Media module installed.

carusen’s picture

UPDATE: My issue came from the Comments Notify module. See problem here confirmed by others: https://drupal.org/node/1273256

j0m’s picture

for me it worked fine to set the "type" to the same value as "filemime"

yuval.j.benhur’s picture

It seems that the fix in the dev version is only for drupal 6

yuval.j.benhur’s picture

Great, it works for me.

you can use this a query like this

UPDATE `file_managed` SET `type`='png' WHERE `file_managed`.`filemime` = 'image/png' LIMIT 10

make sure to set the type according to the filemime.

femrich’s picture

Not sure how to apply this patch and not currently using Media module (though I hope to shortly), so disabled media module but the problem did not go away. When I disabled File Entity, however, it did go away. Unfortunately, I do want to work with File Entity now because I am working through an og/panels demo that uses it. Will track this and hope for updates soon...

Update: I see that the version of File Entity I have installed is bundled with Media 7.x-1.0 beta 5, and that the freestanding File Entity module must be used with the (unstable, apparently) 7.x-2.0 branch of Media. Of course trying to install the freestanding File Entity did not work with Media 1 beta 5 installed, so will uninstall media module, try installing the freestanding File Entity module, and hope for updates to Media soon...

theullrich’s picture

For those with with media gallerys installed #19 does not work. Gallerys requires media Beta5, so i am just doing a roll back.

femrich’s picture

@theullrich, #19 doesn't work at all, it seems, as Media 7.x-1.x does not allow itself to be uninstalled. Are you rolling back to the previous version of drupal core? Looks like I may need to do the same.

damien_vancouver’s picture

I also had this issue.

I also fixed it by appling the pach in http://drupal.org/node/1067750#comment-4941822

For those who are patch-challenged, the patch is just changing one line.

You can make the change yourself by editing the file includes/common.inc. Edit line 7388, right after the comment: // Explicitly fail for malformed entities missing the bundle property.

Change line 7388 from:

 if (!isset($entity->{$info['entity keys']['bundle']}) || $entity->{$info['entity keys']['bundle']} === '') {


if (!isset($entity->{$info['entity keys']['bundle']})) {

Save the file, and your site should load.

The Media module team is working on a fix to the media module. You will need to upgrade to the fixed Media module when it comes out. Otherwise, when you update Drupal core again this issue will come back!

lsolesen’s picture

Subscribe. Encountered when uploading a pdf in a field.

femrich’s picture

@ damien_vancouver, thanks for the guidance. Unfortunately I'm a complete newbie at coding and somehow screwed this up (100% my fault, I'm sure), but was glad for the experience of trying. For now have downgraded to 7.7 core and am also enjoying becoming more comfortable with upgrading/downgrading core. (Even screwing things up can be fun if you're a newbie, though the stress of keeping the site going is still there...)


damien_vancouver’s picture


Hopefully when you say "downgrading core" you mean loading a database backup you made before you tried to upgrade it. You can't downgrade modules or core in Drupal without rolling back to a previous database backup.

That's because most core and module updates run database fixes too, which aren't reversible. If you switch the PHP files back to an older version and don't also load a backup of the database, you might cause more problems later on. Just FYI. :) The rule of thumb is to always, always always make a database backup before changing anything. And if you roll back, just put the files back how they were, and then restore your database to that backup.

femrich’s picture

@Damien, thanks. Good to know. I do still have the backup I made before upgrading to 7.8, so will re-install from the backup. One more newbie mistake I won't make again...

Wappie08’s picture

Thanks for #22, easy fix!

Greetings Wappie

mpcm’s picture

Encountered, subscribing.

petsta’s picture

#22 worked for me. Thanks.

Dave Reid’s picture

Status: Active » Closed (duplicate)

This is a duplicate of #1268378: Empty file type causes exceptions in Drupal 7.8 which has more work on it.

goldlilys’s picture


#22 works but there has to be a way to fix this without hacking core.

misterbenny’s picture

In the media section of the configuration menu, there is a option to fill the missing type field automatically. This should fix the problem..

medden’s picture

I got this error after updating Organic Groups module to 7.1.2.

Liat’s picture

Same here

mgifford’s picture

I got this after upgrading Tokens..

I've not upgraded to 7.9 yet, but not sure if that will make it better or worse..

damien_vancouver’s picture


I think the root cause of this error is now fixed as of Media module release 7.0-1.0-rc1 (a copule releases ago). From the 7.x-1.0-rc1 Release Notes:

#1268378: Empty file type causes exceptions in Drupal 7.8 by effulgentsia, chx, Dave Reid, becw: Fixed Empty file type causes exceptions in Drupal 7.8.

So as long as your Media module has been upgraded to 7.x-1.0-rc1 or newer, this error should not happen after you upgrade core to Drupal 7.9.

That being said, be sure to test it first on a development or staging server before trying it on your live site. Good luck!

mgifford’s picture

It wasn't really a complaint about the Media module. Not even sure if it's enabled, so sorry. I did get that error elsewhere I ended posting up what I'd done here:


Ganginator’s picture

Status: Closed (duplicate) » Active

I am so upset.
This error completely locked me out of my site so I couldn't even disable and uninstall the module and the patch failed to help whatsoever...
Simply activating a module should not cripple your site!
Now I have to start from scratch.
Luckily I wasn't farther down the line when I activated this.
All I lost was 7 views and 7 content types.
It's still ridiculous that activating a single module could bring down an entire site.
This should be noted on the module's page so that others don't loose their work!
If anyone has an opinion of the best or at least a better video module for Drupal 7 please contact me.
Media Module sounded like a great module, and exactly what I needed, but I can't understand why it was developed with such a critical error that cripples your site?

Ross-Hunter’s picture

Look into Drush to disable modules without having to log into your site. Absolutely essential.

Dave Reid’s picture

Status: Active » Closed (duplicate)

Please make sure to use the current release and run update.php.

Ganginator’s picture

Just started using Drush.
Wish I would have before deleting my site...

bredi’s picture

installing this module took down my site.

EntityMalformedException: Missing bundle property on entity of type file. in entity_extract_ids() (line 7539 of /home/xxx/public_html/includes/common.inc).

It also deactivated modules??? which I have never encountered before.

i'm unable to uninstall media or file entity. they are grayed out. even after disabling all modules that it depends on or is depended on.

once again, its almost almost impossible to get media into a drupal site.

rant finished. thanks for your hard work and donated time.
however, this needs some major warnings on the project pages.

bredi’s picture

after trying many things. I finaly went for a hail mary and installed media 2.x-dev and file_entity-7.x-2.x.

This allowed me to disable both modules! The errors went away. I then promptly "uninstalled them".

thanks. Hope this trick works and didn't leave any junk from Media-1-x in the tables.


update:Running update.php for other purposes wanted to update file entity updates. I opted to continue and got errors.
so, I'll most likely have to go through the tables.
maybe, I'll try installing the older modules again. and try to "uninstall".

spanac’s picture

resolved same issue with taxonomy on commerce products. Not related to media, but after importing some products, some of them didn't have any tokens or N/A set. That caused an error: EntityMalformedException: Missing bundle property on entity of type taxonomy_term. in entity_extract_ids() (line 7539 of includes/common.inc). After setting taxonomy term to n/a value or any other value, that fixed this error.

HongPong’s picture

This may be a tangent but if you have malformed files entities - see #1446440: Unable to view me media management pages (EntityMalformedException: Missing bundle property...) for my one-off SQL fix for column type in the files_managed table.

mghamsari’s picture

The solution presented by #5 worked for me, but I'm using the latest dev version of file_entity : 7.x-2.x-dev
I was wondering whether the problem was already solved by the patches or not?

tafkey’s picture

Component: File entity » Code
Status: Closed (duplicate) » Needs review
495 bytes
PASSED: [[SimpleTest]]: [MySQL] 62 pass(es). View

Could it be an issue related to the (core) comment module. For me, this patch did the trick:

*** modules/comment/comment.module	2013-05-03 15:57:52.000000000 +0300
--- modules/comment/comment.module.patched	2013-06-03 04:15:30.000000000 +0300
*************** function comment_get_thread($node, $mode
*** 869,870 ****
--- 869,874 ----
  function comment_prepare_thread(&$comments) {
+   // trying to resolve https://drupal.org/node/1266620 (@tafkey, Jun 3, 2013) 
+   if (empty($comments)) return;
    // A flag stating if we are still searching for first new comment on the thread.
markosaurus’s picture

I've seen this issue loads of times in drupal and can never remember how to fix it!

It's when you install the media module but no "type" is assigned, like you said above.

The fix was a bit more complicated for me because I got a "missing entity" type message when I tried to clear all caches through the admin_menu module.

I had to go into the file_managed table, find the row without a "type" assigned, assign the correct type and then manually empty all of the cache tables.

After that I was able to clear caches again through the CMS.

markosaurus’s picture

This fixed it for me too, thanks :)

I then had to manually clear the caches from the DB in order to banish the error.

Trying to clear the caches through the CMS failed due to the error showing before the caches cleared.

It being a fatal error caused execution to halt!

sylus’s picture

Status: Needs review » Closed (fixed)

Closing this issue as there is a clear fix in place and while media may have made the problem become apparent, not sure it would result in the type row being empty. Hope this is okay!

skessler’s picture

#48 worked for me.


skessler’s picture

Issue summary: View changes

Added note that filed issue in wrong queue.

i92guboj’s picture

#47 was the issue in my case. The file_managed table in fact doesn't seem to have a "type" field here ;)

I guess this could have been caused by an update to the entity module some days ago, but since the issue appeared in a site that I only use for showcasing purposes I didn't notice until five minutes ago.

Cool that I found this thread the minute after that.

Thanks :)

danielbeeke’s picture

I had this issue,

fixed it somehow by setting the module weight of file entity to -1 in the system table.

All my files had an entry for type in the file_managed table.

ledzepp94’s picture

Confirmed danielbeeke's solution works for me.

db_query("UPDATE {system} SET weight = -1 WHERE name = 'file_entity'");

vishal.sirsodiya’s picture

Status: Closed (fixed) » Needs review

47: fix-missing-bundle.patch queued for re-testing.

marcoka’s picture

Issue summary: View changes

setting weight did not work here. will test the patch.

vlooivlerke’s picture

#47 Works, This fixed "Broken/Missing Handler in Views using Entity Reference"

This is not a media module problem, much deeper.
Should we let the comment module know?

bgogoi’s picture

This solved my issue: http://www.nicklitten.com/blog/notice-undefined-variable-key-commentprep...

I deleted the orphaned comments (blank with no uid)

meecect’s picture

#54 fixed the issue for us.

Yuri’s picture

#47 is not patching any more

Chris Charlton’s picture


joseph.olstad’s picture

solution #48 seems like a reasonable workaround.

solution #58 also looks like a reasonable workaround

patch 47 is a patch to a core module (comment module) , might work as a workaround for some, but not others. Doesn't address the root cause.

joseph.olstad’s picture

Status: Needs review » Postponed (maintainer needs more info)