Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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 /
/includes/common.inc).
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.)
Comment | File | Size | Author |
---|---|---|---|
#47 | fix-missing-bundle.patch | 495 bytes | tafkey |
Comments
Comment #1
Tom P CreditAttribution: Tom P commentedsubscribe
Comment #2
zigmoo CreditAttribution: zigmoo commentedme too!
Comment #3
nemo_Anhoa CreditAttribution: nemo_Anhoa commentedsubscribe, I encounter this also after upgrade to 7.8
Comment #4
Desi Raaj CreditAttribution: Desi Raaj commentedsame issue here
Comment #5
leeresglas CreditAttribution: leeresglas commentedI 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...
Comment #6
willmoy CreditAttribution: willmoy commentedleeresglas 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.
Comment #7
wojtek.krawczyk CreditAttribution: wojtek.krawczyk commentedsubscribe
Comment #8
Starminder CreditAttribution: Starminder commentedsubscribe
Comment #9
somatics CreditAttribution: somatics commentedWe 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)."
Comment #10
effulgentsia CreditAttribution: effulgentsia commentedRe #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.
Comment #11
2ifx.com CreditAttribution: 2ifx.com commentedThanks, that patch found here: #1067750-49: Let Field API fail in a tale-telling way on invalid $entity worked for me!!
Comment #12
nitmd CreditAttribution: nitmd commentedI 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?
Comment #13
texis CreditAttribution: texis commentedSubscribe
Comment #14
carusen CreditAttribution: carusen commentedsubscribe. I just migrated from 7.7 to 7.8
I do not have any Media module installed.
Comment #15
carusen CreditAttribution: carusen commentedUPDATE: My issue came from the Comments Notify module. See problem here confirmed by others: https://drupal.org/node/1273256
Comment #16
j0m CreditAttribution: j0m commentedfor me it worked fine to set the "type" to the same value as "filemime"
Comment #17
YuvalBH CreditAttribution: YuvalBH commentedIt seems that the fix in the dev version is only for drupal 6
Comment #18
YuvalBH CreditAttribution: YuvalBH commentedGreat, 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.
Comment #19
femrich CreditAttribution: femrich commentedNot 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...
Comment #20
theullrich CreditAttribution: theullrich commentedFor those with with media gallerys installed #19 does not work. Gallerys requires media Beta5, so i am just doing a roll back.
Comment #21
femrich CreditAttribution: femrich commented@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.
Comment #22
damien_vancouver CreditAttribution: damien_vancouver commentedI 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:
to:
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!
Comment #23
lsolesen CreditAttribution: lsolesen commentedSubscribe. Encountered when uploading a pdf in a field.
Comment #24
femrich CreditAttribution: femrich commented@ 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...)
Cheers!
Comment #25
damien_vancouver CreditAttribution: damien_vancouver commented@femrich,
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.
Comment #26
femrich CreditAttribution: femrich commented@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...
Comment #27
Wappie08 CreditAttribution: Wappie08 commentedThanks for #22, easy fix!
Greetings Wappie
Comment #28
mpcm CreditAttribution: mpcm commentedEncountered, subscribing.
Comment #29
petsta CreditAttribution: petsta commented#22 worked for me. Thanks.
Comment #30
Dave ReidThis is a duplicate of #1268378: Empty file type causes exceptions in Drupal 7.8 which has more work on it.
Comment #31
goldlilys CreditAttribution: goldlilys commentedSubscribing.
#22 works but there has to be a way to fix this without hacking core.
Comment #32
misterbenny CreditAttribution: misterbenny commentedIn the media section of the configuration menu, there is a option to fill the missing type field automatically. This should fix the problem..
Comment #33
medden CreditAttribution: medden commentedI got this error after updating Organic Groups module to 7.1.2.
Comment #34
Liat CreditAttribution: Liat commentedSame here
Comment #35
mgiffordI got this after upgrading Tokens..
I've not upgraded to 7.9 yet, but not sure if that will make it better or worse..
Comment #36
damien_vancouver CreditAttribution: damien_vancouver commented@mgifford,
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:
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!
Comment #37
mgiffordIt 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:
http://drupal.org/node/1277376#comment-5172312
Comment #38
Ganginator CreditAttribution: Ganginator commentedI 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?
Comment #39
Ross-Hunter CreditAttribution: Ross-Hunter commentedLook into Drush to disable modules without having to log into your site. Absolutely essential.
Comment #40
Dave ReidPlease make sure to use the current release and run update.php.
Comment #41
Ganginator CreditAttribution: Ganginator commentedJust started using Drush.
Wish I would have before deleting my site...
Comment #42
bredi CreditAttribution: bredi commentedinstalling 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.
Comment #43
bredi CreditAttribution: bredi commentedafter 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.
bredi
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".
Comment #44
spanac CreditAttribution: spanac commentedresolved 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.
Comment #45
HongPong CreditAttribution: HongPong commentedThis 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.
Comment #46
mghamsari CreditAttribution: mghamsari commentedThe 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?
Comment #47
tafkey CreditAttribution: tafkey commentedCould it be an issue related to the (core) comment module. For me, this patch did the trick:
Comment #48
markosaurus CreditAttribution: markosaurus commentedI'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.
Comment #49
markosaurus CreditAttribution: markosaurus commentedThis 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!
Comment #50
sylus CreditAttribution: sylus commentedClosing 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!
Comment #51
skessler#48 worked for me.
Thanks,
Steve
Comment #51.0
skesslerAdded note that filed issue in wrong queue.
Comment #52
i92guboj CreditAttribution: i92guboj commented#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 :)
Comment #53
danielbeeke CreditAttribution: danielbeeke commentedI 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.
Comment #54
ledzepp94 CreditAttribution: ledzepp94 commentedConfirmed danielbeeke's solution works for me.
db_query("UPDATE {system} SET weight = -1 WHERE name = 'file_entity'");
Comment #55
vishal.sirsodiya CreditAttribution: vishal.sirsodiya commented47: fix-missing-bundle.patch queued for re-testing.
Comment #56
marcoka CreditAttribution: marcoka commentedsetting weight did not work here. will test the patch.
Comment #57
vlooivlerke CreditAttribution: vlooivlerke commented#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?
Comment #58
bgogoi CreditAttribution: bgogoi commentedThis solved my issue: http://www.nicklitten.com/blog/notice-undefined-variable-key-commentprep...
I deleted the orphaned comments (blank with no uid)
Comment #59
meecect CreditAttribution: meecect as a volunteer commented#54 fixed the issue for us.
Comment #60
Yuri CreditAttribution: Yuri commented#47 is not patching any more
Comment #61
Chris CharltonBump.
Comment #62
joseph.olstadsolution #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.
Comment #63
joseph.olstadComment #64
steinmb CreditAttribution: steinmb as a volunteer commentedComment #66
adancillo CreditAttribution: adancillo as a volunteer commentedFor those who still got stuck on this issue.
$ drush en media_migrate_file_types -y
Then go to /admin/structure/file-types/upgrade
This form will rebuild the type column in file_managed table
Comment #67
lubwn CreditAttribution: lubwn commentedAnyone coming to this issue - it was related to Feeds module in my case. But since I had almost finished site and did not want to re-build it from scratch, I just decided to deal with the problem.
So my error was:
EntityMalformedException: Missing bundle on commerce_product. in entity_extract_ids() (riadok 7948 z /var/www/clients/client1/web30/web/includes/common.inc).
So it was related to "commerce_product" entity.
Solution:
Find this table in phpmyadmin and set autoincrement value to very high number - like 10000 or so.
What caused this problem:
I think I imported a LOT of nodes and commerce products via feeds, and deleted them afterwards. But Drupal did not cleaned all the things up and left some orphaned rows somewhere. Maybe they are entities, maybe they are nodes.. I have no idea. But it works nicely now.
So just find a table and increase autoincrement. It does not "solve" the problem in the proper way, but rather hide it for good.